import { Column, CreateDateColumn, Entity, Index, PrimaryColumn } from 'typeorm';

@Entity({ name: 'media_files' })
export class MediaOrmEntity {
  @PrimaryColumn({ type: 'uuid' })
  id!: string;

  @Column({ type: 'text' })
  filename!: string;

  @Column({ type: 'text' })
  originalName!: string;

  @Column({ type: 'text' })
  mimeType!: string;

  @Column({ type: 'integer' })
  size!: number;

  @Column({ type: 'text' })
  url!: string;

  @Column({ type: 'text' })
  type!: string;

  @Index()
  @Column({ type: 'text' })
  uploadedBy!: string;

  @CreateDateColumn({ type: 'timestamptz' })
  uploadedAt!: Date;

  @Column({ type: 'jsonb', nullable: true })
  metadata!: Record<string, unknown> | null;
}
