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

@Entity('breakage_records')
export class BreakageRecord {
  @PrimaryGeneratedColumn('uuid') id: string;
  @Column({ name: 'coupon_id', type: 'uuid' }) couponId: string;
  @Column({ name: 'issuer_id', type: 'uuid' }) issuerId: string;
  @Column({ name: 'total_issued', type: 'int' }) totalIssued: number;
  @Column({ name: 'total_redeemed', type: 'int' }) totalRedeemed: number;
  @Column({ name: 'total_expired', type: 'int' }) totalExpired: number;
  @Column({ name: 'breakage_amount', type: 'numeric', precision: 20, scale: 8 }) breakageAmount: string;
  @Column({ name: 'breakage_rate', type: 'numeric', precision: 5, scale: 4 }) breakageRate: string;
  @Column({ name: 'recognition_method', type: 'varchar', length: 50, default: 'proportional' }) recognitionMethod: string;
  @CreateDateColumn({ name: 'calculated_at', type: 'timestamptz' }) calculatedAt: Date;
}
