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

@Entity('whatsapp_templates')
export class WhatsappTemplate {
  @PrimaryGeneratedColumn()
  id: number;

  @Column()
  name: string;

  @Column({ type: 'text' })
  body: string;

  @Column({ type: 'text', nullable: true })
  variables: string; // JSON string or comma-separated list

  @Column({ length: 10, default: 'en' })
  language_code: string;

  @Column({ type: 'tinyint', width: 1, default: 1 })
  is_active: boolean;

  @Column({ type: 'enum', enum: ['utility', 'marketing'], nullable: true })
  category: 'utility' | 'marketing';

  @Column({
    type: 'enum',
    enum: ['candidate', 'employer', 'admin'],
    nullable: true,
  })
  recipient: 'candidate' | 'employer' | 'admin';

  @CreateDateColumn()
  created_at: Date;

  @UpdateDateColumn()
  updated_at: Date;
}
