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

@Entity('credit_metrics')
export class CreditMetric {
  @PrimaryGeneratedColumn('uuid') id: string;
  @Column({ name: 'issuer_id', type: 'uuid' }) issuerId: string;
  @Column({ name: 'redemption_rate', type: 'numeric', precision: 5, scale: 4, default: '0' }) redemptionRate: string;
  @Column({ name: 'breakage_rate', type: 'numeric', precision: 5, scale: 4, default: '0' }) breakageRate: string;
  @Column({ name: 'tenure_days', type: 'int', default: 0 }) tenureDays: number;
  @Column({ name: 'satisfaction_score', type: 'numeric', precision: 5, scale: 2, default: '0' }) satisfactionScore: string;
  @Column({ name: 'composite_score', type: 'numeric', precision: 5, scale: 2, default: '50' }) compositeScore: string;
  @Column({ name: 'score_level', type: 'varchar', length: 2, default: 'C' }) scoreLevel: string;
  @CreateDateColumn({ name: 'calculated_at', type: 'timestamptz' }) calculatedAt: Date;
}
