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

  @Entity({ name: 'lookups' })
  @Index(['type', 'code'], { unique: true })
  export class Lookup {
    @PrimaryGeneratedColumn('uuid')
    id!: string;

    // loan_purpose | loan_title | saving_type | income_source | collateral_type
    // business_type | occupation_type | insurance_type | relationship_type
    @Index()
    @Column({ type: 'varchar', length: 60 })
    type!: string;

    @Column({ type: 'varchar', length: 80 })
    code!: string;

    @Column({ type: 'varchar', length: 250 })
    label!: string;

    @Column({ type: 'varchar', name: 'label_ne', length: 250, nullable: true })
    labelNe?: string;

    @Column({ type: 'varchar', nullable: true })
    value?: string;

    /** Extra JSON data as text string (interest_rate, address, phone, etc.) */
    @Column({ type: 'text', nullable: true })
    meta?: string;

    @Column({ default: 0 })
    order!: number;

    @Column({ default: true })
    active!: boolean;

    @CreateDateColumn()
    createdAt!: Date;

    @UpdateDateColumn()
    updatedAt!: Date;
  }
