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

@Entity("taller_cotizacion_versiones")
export class CotizacionVersion {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({ name: "cotizacion_id", type: "int" })
  @Index()
  cotizacionId: number;

  @Column({ type: "int" })
  version: number;

  @Column({ length: 50 })
  estado: string;

  @Column({ type: "json" })
  snapshot: Record<string, any>;

  @Column({ type: "text", nullable: true })
  motivo: string | null;

  @Column({ name: "created_by", type: "int", nullable: true })
  createdBy: number | null;

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