import { DB_SCHEMA } from 'src/utils';
import { Column, Entity, Index, PrimaryGeneratedColumn } from 'typeorm';

@Index(
  'course_master_id',
  ['course_master_id', 'intakeyear', 'intakemonth', 'campusId', 'intakeStatus'],
  {},
)
@Entity('course_master_intake_years', { schema: DB_SCHEMA })
export class CourseMasterIntakeYearsEntity {
  @PrimaryGeneratedColumn({ type: 'int', name: 'intakYId' })
  intakYId: number;

  @Column('mediumint', { name: 'course_master_id' })
  course_master_id: number;

  @Column('year', { name: 'intakeyear', nullable: true })
  intakeyear: number | null;

  @Column('varchar', { name: 'intakemonth', length: 15 })
  intakemonth: string;

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

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

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

  @Column('timestamp', {
    name: 'createdOn',
    default: () => 'CURRENT_TIMESTAMP',
  })
  createdOn: Date;

  @Column('timestamp', {
    name: 'modifiedOn',
    default: () => 'CURRENT_TIMESTAMP',
  })
  modifiedOn: Date;
}
