import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';

@Entity('vod_videos')
export class VodVideo {
  @PrimaryGeneratedColumn({ unsigned: true })
  id!: number;

  @Column({ 
    name: 'title', 
    type: 'varchar', 
    length: 255,
    comment: '视频标题'
  })
  title!: string;

  @Column({ 
    name: 'description', 
    type: 'text', 
    nullable: true,
    comment: '视频描述'
  })
  description!: string | null;

  @Column({ 
    name: 'file_id', 
    type: 'varchar', 
    length: 255,
    comment: 'VOD文件ID'
  })
  fileId!: string;

  @Column({ 
    name: 'video_url', 
    type: 'varchar', 
    length: 500,
    comment: '视频播放地址'
  })
  videoUrl!: string;

  @Column({ 
    name: 'cover_url', 
    type: 'varchar', 
    length: 500,
    nullable: true,
    comment: '封面图片地址'
  })
  coverUrl!: string | null;

  @Column({ 
    name: 'duration', 
    type: 'int', 
    unsigned: true,
    default: 0,
    comment: '视频时长（秒）'
  })
  duration!: number;

  @Column({ 
    name: 'size', 
    type: 'bigint', 
    unsigned: true,
    default: 0,
    comment: '视频大小（字节）'
  })
  size!: number;

  @Column({ 
    name: 'status', 
    type: 'tinyint', 
    default: 0,
    comment: '视频状态（0: 待处理, 1: 处理中, 2: 已完成, 3: 失败）'
  })
  status!: number;

  @Column({ 
    name: 'created_by', 
    type: 'int', 
    unsigned: true,
    nullable: true,
    comment: '创建人ID'
  })
  createdBy!: number | null;

  @Column({ 
    name: 'updated_by', 
    type: 'int', 
    unsigned: true,
    nullable: true,
    comment: '更新人ID'
  })
  updatedBy!: number | null;

  @CreateDateColumn({ name: 'created_at' })
  createdAt!: Date;

  @UpdateDateColumn({ name: 'updated_at' })
  updatedAt!: Date;
}