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

@Index('active', ['active'], {})
@Index('duration_type', ['duration_type'], {})
@Index('institueId', ['institueId'], {})
@Entity('course_master', { schema: DB_SCHEMA })
export class CourseMasterEntity {
  @PrimaryGeneratedColumn({ type: 'mediumint', name: 'course_id' })
  course_id: number;

  @Column('smallint', { name: 'by_user' })
  by_user: number;

  @Column('varchar', { name: 'UID', length: 50 })
  UID: string;

  @Column('smallint', { name: 'institueId' })
  institueId: number;

  @Column('char', { name: 'currency', comment: '1=CAD,2=USD,3=INR', length: 3 })
  currency: string;

  @Column('varchar', { name: 'course_name', length: 255 })
  course_name: string;

  @Column('float', {
    name: 'application_fee',
    nullable: true,
    precision: 12,
    default: () => "'0'",
  })
  application_fee: number | null;

  @Column('varchar', { name: 'tution_fee_inter', length: 10 })
  tution_fee_inter: string;

  @Column('tinyint', {
    name: 'tution_fee_per',
    comment: '1=semester,2=year,3=full',
    width: 1,
  })
  tution_fee_per: boolean;

  @Column('tinyint', {
    name: 'duration_type',
    comment: '1=semester, 2= year',
    width: 1,
  })
  duration_type: boolean;

  @Column('float', { name: 'duration', precision: 12 })
  duration: number;

  @Column('float', { name: 'max_duration', nullable: true, precision: 12 })
  max_duration: number | null;

  @Column('varchar', { name: 'website', length: 250 })
  website: string;

  @Column('text', { name: 'notesCourse', nullable: true })
  notesCourse: string | null;

  @Column('text', { name: 'aboutCourse', nullable: true })
  aboutCourse: string | null;

  @Column('tinyint', { name: 'active', width: 1 })
  active: boolean;

  @Column('varchar', { name: 'OTP', nullable: true, length: 4 })
  OTP: string | null;

  @Column('tinyint', { name: 'is_email_verified', width: 1 })
  is_email_verified: boolean;

  @Column('varchar', { name: 'reasonForDelete', nullable: true, length: 150 })
  reasonForDelete: string | null;

  @Column('tinyint', { name: 'isComplete', width: 1, default: () => "'0'" })
  isComplete: boolean;

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

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

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