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

@Entity({ name: 'blacklists' })
export class Blacklist {
  @PrimaryGeneratedColumn('uuid')
  id!: string;

  @Index()
  @Column({ type: 'varchar', length: 36 })
  memberId!: string;

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

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

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

  /** active | whitelisted */
  @Column({ type: 'varchar', length: 30, default: 'active' })
  blacklistStatus!: string;

  /** debt_type: loan | interest | other */
  @Column({ type: 'varchar', length: 60, nullable: true })
  debtType?: string;

  @Column({ type: 'decimal', precision: 14, scale: 2, nullable: true })
  outstandingAmount?: number;

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

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

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

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

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

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

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

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

  @CreateDateColumn()
  createdAt!: Date;

  @UpdateDateColumn()
  updatedAt!: Date;

  @DeleteDateColumn()
  deletedAt?: Date;
}
