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

@Entity('letter_templates')
export class LetterTemplate {
  @PrimaryGeneratedColumn('uuid') id: string;

  @Column({ type: 'varchar', length: 50, unique: true }) code: string;
  @Column({ type: 'varchar', length: 300 }) title: string;
  @Column({ type: 'varchar', length: 300, nullable: true }) titleNe: string | null;

  @Column({ type: 'varchar', length: 30, default: 'general' })
  category: string;

  @Column({ type: 'varchar', length: 30, default: 'none' })
  recordType: string;

  @Column({ type: 'text', nullable: true }) body: string | null;
  @Column({ type: 'text', nullable: true }) bodyNe: string | null;
  @Column({ type: 'text', nullable: true }) variables: string | null;

  @Column({ type: 'varchar', nullable: true }) filePath: string | null;
  @Column({ type: 'varchar', length: 300, nullable: true }) importTemplateName: string | null;

  @Column({ type: 'boolean', default: true }) isActive: boolean;
  @Column({ type: 'varchar', nullable: true }) officeId: string | null;
  @Column({ type: 'varchar', nullable: true }) createdById: string | null;
  @Column({ type: 'varchar', length: 200, nullable: true }) createdByName: string | null;

  @CreateDateColumn() createdAt: Date;
  @UpdateDateColumn() updatedAt: Date;
  @DeleteDateColumn() deletedAt: Date | null;
}
