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

@Index('sub_agent_commission_id', ['sub_agent_commission_id'], {})
@Index('visa_case_id', ['visa_case_id'], {})
@Entity('vcm_sub_agent_commission_details', {
  schema: DB_SCHEMA,
})
export class VcmSubAgentCommissionDetailsEntity {
  @PrimaryGeneratedColumn({ type: 'mediumint', name: 'id', unsigned: true })
  id: number;

  @Column('mediumint', {
    name: 'sub_agent_commission_id',
    nullable: true,
    unsigned: true,
  })
  sub_agent_commission_id: number | null;

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

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

  @Column('tinyint', { name: 'commission_type', comment: '1=Fixed, 2=Percent' })
  commission_type: number;

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

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

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

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

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

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