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

@Entity('kpis')
export class Kpi {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column({ length: 200 })
  nome: string;

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

  @Column({ length: 300, nullable: true })
  formula: string;

  @Column({ length: 30 })
  categoria: string; // financeiro | operacional | qualidade | prazo

  @Column({ length: 30, nullable: true })
  unidade: string;

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

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

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

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

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

  @Column({ length: 20, default: 'verde' })
  status: string; // verde | amarelo | vermelho

  @CreateDateColumn()
  created_at: Date;
}
