/**
 * 视频生成模块 - 类型定义
 */

// ============ 核心类型 ============

/** 视频项目状态 */
export type VideoProjectStatus = 'draft' | 'processing' | 'completed' | 'failed';

/** 素材类型 */
export type MaterialType = 'image' | 'audio' | 'template';

/** 转场效果 */
export type TransitionEffect = 'none' | 'fade' | 'slide';

/** 字幕位置 */
export type SubtitlePosition = 'top' | 'bottom' | 'center';

/** 图片配置项 */
export interface ImageConfig {
  url: string;
  duration: number;
  transition: TransitionEffect;
  kenburns?: KenBurnsConfig;
}

/** Ken Burns 效果配置 */
export interface KenBurnsConfig {
  enabled: boolean;
  minZoom: number;
  maxZoom: number;
  panDirection?: 'in' | 'out' | 'left' | 'right' | 'random';
  zoomCurve?: 'linear' | 'ease-in' | 'ease-out' | 'ease-in-out';
}

/** 音频配置 */
export interface AudioConfig {
  url: string;
  startTime?: number;
  endTime?: number;
  volume: number;
}

/** 背景音乐配置 */
export interface BgmConfig {
  url: string;
  volume: number;
  loop: boolean;
  fadeIn?: number;
  fadeOut?: number;
}

/** 字幕配置 */
export interface SubtitleConfig {
  text: string;
  fontSize?: number;
  fontColor?: string;
  backgroundColor?: string;
  position: SubtitlePosition;
  margin?: number;
  style?: 'normal' | 'bold';
}

/** 视频参数 */
export interface VideoParams {
  width: number;
  height: number;
  fps: number;
  bitrate: string;
  format: string;
}

/** 完整视频配置 */
export interface VideoConfig {
  images: ImageConfig[];
  audio: AudioConfig;
  bgm?: BgmConfig;
  subtitle?: SubtitleConfig;
  video: VideoParams;
  kenburns: KenBurnsConfig;
}

// ============ 预设配置 ============

/** 预设视频配置 */
export const PRESET_VIDEO_CONFIGS: Record<string, VideoConfig> = {
  portrait: {
    images: [],
    audio: { url: '', volume: 1 },
    video: { width: 720, height: 1280, fps: 30, bitrate: '2M', format: 'mp4' },
    kenburns: { enabled: true, minZoom: 1.0, maxZoom: 1.2 },
  },
  landscape: {
    images: [],
    audio: { url: '', volume: 1 },
    video: { width: 1920, height: 1080, fps: 30, bitrate: '4M', format: 'mp4' },
    kenburns: { enabled: true, minZoom: 1.0, maxZoom: 1.15 },
  },
  square: {
    images: [],
    audio: { url: '', volume: 1 },
    video: { width: 1080, height: 1080, fps: 30, bitrate: '2M', format: 'mp4' },
    kenburns: { enabled: true, minZoom: 1.0, maxZoom: 1.25 },
  },
};

/** 素材分类 */
export const MATERIAL_CATEGORIES = [
  { value: 'nature', label: '自然风景' },
  { value: 'abstract', label: '抽象艺术' },
  { value: 'business', label: '商务办公' },
  { value: 'technology', label: '科技数码' },
  { value: 'lifestyle', label: '生活方式' },
  { value: 'music', label: '背景音乐' },
];
