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

@Entity('propostas')
export class Proposta {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column()
  demanda_id: string;

  @Column()
  fornecedor_id: string;

  @Column({ default: 1 })
  versao_atual: number;

  @Column({ type: 'float', nullable: true })
  valor_bruto: number;

  @Column({ type: 'float', nullable: true })
  valor_liquido: number;

  @Column({ type: 'simple-json', default: '{}' })
  impostos: any;

  @Column({ type: 'text', nullable: true })
  condicao_pagamento: string;

  @Column({ nullable: true })
  prazo_execucao_dias: number;

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

  @Column({ type: 'float', nullable: true })
  match_escopo_pct: number;

  @Column({ type: 'float', nullable: true })
  confiabilidade_ocr: number;

  @Column({ default: false })
  selecionada: boolean;

  @Column({ length: 20, nullable: true })
  uso_material_sustentavel: string;

  @Column({ length: 20, nullable: true })
  gera_residuos: string;

  @Column({ length: 20, nullable: true })
  descarte_certificado: string;

  @Column({ length: 20, default: 'recebida' })
  status: string;

  @CreateDateColumn()
  created_at: Date;

  @UpdateDateColumn()
  updated_at: Date;
}
