import { DateTime } from 'luxon'
import { BaseModel, column, belongsTo } from '@adonisjs/lucid/orm'
import type { BelongsTo } from '@adonisjs/lucid/types/relations'
import MasterDataCountry from '#models/master_data_country'

export default class InternationalCity extends BaseModel {
  @column({ isPrimary: true })
  declare id: number

  @column()
  declare countryId: number | null

  @column()
  declare countryCode: string | null

  @column()
  declare stateName: string | null

  @column()
  declare name: string

  @column()
  declare country_name: string | null

  @column()
  declare latitude: string | null

  @column()
  declare longitude: string | null

  @column()
  declare isActive: boolean

  @column.dateTime({ autoCreate: true })
  declare createdAt: DateTime

  @column.dateTime({ autoCreate: true, autoUpdate: true })
  declare updatedAt: DateTime

  @belongsTo(() => MasterDataCountry)
  declare country: BelongsTo<typeof MasterDataCountry>
}
