import { City } from "src/modules/city/entities/city.entity"
import { Currency } from "src/modules/currency/entities/currency.entity"
import { Customer } from "src/modules/customers/entities/customer.entity"
import { Hospital } from "src/modules/hospitals/entities/hospital.entity"
import { State } from "src/modules/state/entities/state.entity"
import { Address } from "src/modules/team-member/entities/address.entity"

import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
  OneToMany,
  CreateDateColumn,
  DeleteDateColumn,
  UpdateDateColumn,
  Index,
} from "typeorm"

@Entity("countries")
export class Country {
  @PrimaryGeneratedColumn()
  @Index()
  id: number

  @Column({ type: "varchar", nullable: false })
  @Index()
  name: string

  @DeleteDateColumn()
  deleted_at: Date

  @CreateDateColumn({ type: "timestamp", default: () => "NOW()" })
  created_at: Date

  @UpdateDateColumn({ type: "timestamp", default: () => "NOW()" })
  updated_at: Date

  @OneToMany(() => State, (state) => state.country)
  states: State[]

  @OneToMany(() => City, (city) => city.country)
  cities: City[]

  @OneToMany(() => Currency, (currency) => currency.country)
  currencies: Currency[]

  @OneToMany(() => Country, (currency) => currency.customer)
  customer: Customer[]

  @OneToMany(() => Address, (team_member) => team_member.country)
  addresses: Address[]

  @OneToMany(() => Hospital, (hospital) => hospital.country)
  hospitals: Hospital[]
}
