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

@Entity()
export class History {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ unique: true })
  archive_id: string;

  @Index()
  @Column({ nullable: true })
  batch_id: string;

  @Column()
  filename: string;

  @Column()
  total_count: number;

  @Column({ type: 'simple-json' })
  industrial_summary: Record<string, number>;

  @Column({ type: 'simple-json' })
  detections: any[];

  @Column({ type: 'float' })
  inference_ms: number;

  @Column({ type: 'float' })
  processing_ms: number;

  @Column({ nullable: true })
  image_path: string;

  @CreateDateColumn()
  created_at: Date;
}
