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

@Index('country_id', ['country_id', 'state_id', 'active'], {})
@Entity('city', { schema: DB_SCHEMA })
export class CityEntity {
  @PrimaryGeneratedColumn({ type: 'mediumint', name: 'city_id' })
  city_id: number;

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

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

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

  @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;
}
