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

@Entity('timezone_masters', { schema: DB_SCHEMA })
export class TimezoneMastersEntity {
  @PrimaryGeneratedColumn({ type: 'smallint', name: 'timezone_id' })
  timezone_id: number;

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

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

  @Column('varchar', { name: 'timezone_name', length: 50 })
  timezone_name: string;

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

  @Column('varchar', { name: 'utc', length: 10 })
  utc: string;

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

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