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

@Index('country_id', ['country_id', 'active'], {})
@Entity('state', { schema: DB_SCHEMA })
export class StateEntity {
  @PrimaryGeneratedColumn({ type: 'smallint', name: 'state_id' })
  state_id: number;

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

  @Column('varchar', { name: 'state_name', length: 100 })
  state_name: string;

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

  @Column('tinyint', { name: 'active', nullable: true })
  active: number | 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;
}
