import { DB_SCHEMA } from 'src/utils';
import {
  Column,
  Entity,
  Index,
  JoinColumn,
  ManyToOne,
  PrimaryGeneratedColumn,
} from 'typeorm';
import { CountryEntity } from './Country.entity';

@Index('id', ['id'], {})
@Entity('visa_service_master', { schema: DB_SCHEMA })
export class VisaServiceMasterEntity {
  @PrimaryGeneratedColumn({ type: 'smallint', name: 'id' })
  id: number;

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

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

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

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

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

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

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

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

  @ManyToOne(() => CountryEntity, (country) => country.visa_service_master)
  @JoinColumn({ name: 'country_id' })
  country: CountryEntity;
}
