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

@Entity('whatsapp_message_logs')
export class WhatsappMessageLog {
  @PrimaryGeneratedColumn({ type: 'bigint' })
  id: number;

  @Column({ type: 'bigint' })
  notification_event_id: number;

  @Column({ length: 20 })
  phone: string;

  @Column({ length: 255, nullable: true })
  provider_message_id: string;

  @Column({
    type: 'enum',
    enum: ['sent', 'delivered', 'read', 'failed'],
  })
  status: 'sent' | 'delivered' | 'read' | 'failed';

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

  @CreateDateColumn()
  created_at: Date;
}
