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

@Index(
  'test_module_id',
  ['test_module_id', 'programe_id', 'scoringId', 'gradeId', 'active'],
  {},
)
@Entity('language_proficiency_scoring', { schema: DB_SCHEMA })
export class LanguageProficiencyScoringEntity {
  @PrimaryGeneratedColumn({ type: 'smallint', name: 'proficiencyScoringId' })
  proficiencyScoringId: number;

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

  @Column('tinyint', { name: 'programe_id' })
  programe_id: number;

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

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

  @Column('decimal', {
    name: 'overall_min_per',
    nullable: true,
    precision: 5,
    scale: 2,
  })
  overall_min_per: string | null;

  @Column('decimal', {
    name: 'overall_max_per',
    nullable: true,
    precision: 5,
    scale: 2,
  })
  overall_max_per: string | null;

  @Column('decimal', {
    name: 'listening_min',
    nullable: true,
    precision: 5,
    scale: 1,
  })
  listening_min: string | null;

  @Column('decimal', {
    name: 'listening_max',
    nullable: true,
    precision: 5,
    scale: 1,
  })
  listening_max: string | null;

  @Column('decimal', {
    name: 'reading_min',
    nullable: true,
    precision: 5,
    scale: 1,
  })
  reading_min: string | null;

  @Column('decimal', {
    name: 'reading_max',
    nullable: true,
    precision: 5,
    scale: 1,
  })
  reading_max: string | null;

  @Column('decimal', {
    name: 'writing_min',
    nullable: true,
    precision: 5,
    scale: 1,
  })
  writing_min: string | null;

  @Column('decimal', {
    name: 'writing_max',
    nullable: true,
    precision: 5,
    scale: 1,
  })
  writing_max: string | null;

  @Column('decimal', {
    name: 'speaking_min',
    nullable: true,
    precision: 5,
    scale: 1,
  })
  speaking_min: string | null;

  @Column('decimal', {
    name: 'speaking_max',
    nullable: true,
    precision: 5,
    scale: 1,
  })
  speaking_max: string | null;

  @Column('decimal', {
    name: 'overall_min',
    nullable: true,
    precision: 5,
    scale: 1,
  })
  overall_min: string | null;

  @Column('decimal', {
    name: 'overall_max',
    nullable: true,
    precision: 5,
    scale: 1,
  })
  overall_max: string | null;

  @Column('decimal', {
    name: 'difference',
    nullable: true,
    precision: 5,
    scale: 1,
  })
  difference: string | null;

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

  @Column('tinyint', {
    name: 'has_expiry_limit',
    comment: '1=Yes,0=No',
    default: () => "'1'",
  })
  has_expiry_limit: number;

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

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

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

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