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

import { SCHEMAS } from '../../../config/tables';

@Index('fk_cohort_grp', ['cohortGroupId'], {})
@Entity(SCHEMAS.cohort)
export class CohortEntity {
  @PrimaryGeneratedColumn({ type: 'int', name: 'Cohort_PK' })
  cohortPk: number;

  @Column('varchar', { name: 'Cohort_ID', nullable: true, length: 255 })
  cohortId: string | null;

  @Column('varchar', { name: 'Cohort_Name', nullable: true, length: 255 })
  cohortName: string | null;

  @Column('int', { name: 'Cohort_Group_ID' })
  cohortGroupId: number;

  @Column('date', { name: 'Valid_From', nullable: true })
  validFrom: Date | null;

  @Column('date', { name: 'Valid_to', nullable: true })
  validTo: Date | null;

  @Column('tinyint', {
    name: 'Latest_Flag',
    nullable: true,
    default: () => "'1'",
  })
  latestFlag: number | null;

  @Column('tinyint', {
    name: 'Active_Flag',
    nullable: true,
    default: () => "'1'",
  })
  activeFlag: number | null;

  @Column('datetime', { name: 'Record_Date_Time', nullable: true })
  recordDateTime: Date | null;

  @Column('int', { name: 'Company_Tenant_ID', nullable: true })
  companyTenantId: number | null;
}
