// Video source types
export type VideoSourceType = 'local' | 'server';

export type HlsConversionStatus = 'idle' | 'converting' | 'done' | 'error';

export interface VideoMeta {
  videoId: string;
  filename: string;
  size: number;
  duration: number;
  fps: number;
  width: number;
  height: number;
  codec: string;
  hlsStatus: HlsConversionStatus;
  createdAt: string;
}

// Annotation types
export type AnnotationType = 'subtitle' | 'memo';

export interface AnnotationPosition {
  x: number; // 0-100 percentage
  y: number; // 0-100 percentage
}

export interface AnnotationSize {
  width: number;  // 0-100 percentage
  height: number; // 0-100 percentage
}

export interface AnnotationStyle {
  fontSize?: number;
  color?: string;
  backgroundColor?: string;
}

export interface Annotation {
  id: string;
  videoId: string;
  type: AnnotationType;
  timeStart: number; // seconds (float)
  timeEnd: number;   // seconds (float)
  text: string;
  position: AnnotationPosition;
  size: AnnotationSize;
  style: AnnotationStyle;
  createdAt: string;
  updatedAt: string;
}

export type CreateAnnotationInput = Omit<Annotation, 'id' | 'createdAt' | 'updatedAt'>;
export type UpdateAnnotationInput = Partial<Omit<Annotation, 'id' | 'videoId' | 'createdAt'>>;

// API response types
export interface ApiResponse<T> {
  data?: T;
  error?: string;
}

export interface HlsProgressEvent {
  videoId: string;
  percent: number;
  time: number;
  status: HlsConversionStatus;
}

// Upload types
export interface UploadStatus {
  uploadId: string;
  filename: string;
  size: number;
  uploadedBytes: number;
  status: 'uploading' | 'complete' | 'error';
}
