import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  CreateDateColumn,
  UpdateDateColumn,
} from 'typeorm';

@Entity('country')
export class Country {
  @PrimaryGeneratedColumn({ name: 'country_id' })
  country_id: number;

  @Column({ type: 'varchar', length: 30 })
  country_code: string;

  @Column({ type: 'varchar', length: 200 })
  country_name: string;

  @Column({
    type: 'varchar',
    length: 5,
    nullable: true,
    collation: 'utf8mb4_unicode_ci',
  })
  currency_symbol: string | null;

  @Column({ type: 'varchar', length: 5, nullable: true })
  currency: string | null;

  @Column({ type: 'int', default: 1 })
  status: number;

  @CreateDateColumn({
    name: 'created_at',
    type: 'timestamp',
    default: () => 'CURRENT_TIMESTAMP',
  })
  createdAt: Date;

  @UpdateDateColumn({
    name: 'updated_at',
    type: 'timestamp',
    default: () => 'CURRENT_TIMESTAMP',
    onUpdate: 'CURRENT_TIMESTAMP',
  })
  updatedAt: Date;
}
