package com.applemand.zmanim.core.location

import androidx.room.ColumnInfo
import androidx.room.Entity
import androidx.room.Fts4
import androidx.room.PrimaryKey

/**
 * One row per city from the prebuilt GeoNames cities500 extract.
 * Location DB ships in app assets as `databases/cities.db`.
 */
@Entity(tableName = "cities")
data class CityEntity(
    @PrimaryKey val id: Long,
    @ColumnInfo(name = "name_en") val nameEn: String,
    @ColumnInfo(name = "name_he") val nameHe: String?,
    @ColumnInfo(name = "asciiname") val asciiname: String,
    @ColumnInfo(name = "country") val country: String,
    @ColumnInfo(name = "admin1") val admin1: String?,
    @ColumnInfo(name = "lat") val lat: Double,
    @ColumnInfo(name = "lng") val lng: Double,
    @ColumnInfo(name = "tzid") val tzid: String,
    @ColumnInfo(name = "population") val population: Long,
    @ColumnInfo(name = "elevation_m") val elevationM: Double,
)

@Fts4(contentEntity = CityEntity::class)
@Entity(tableName = "cities_fts")
data class CityFtsEntity(
    @ColumnInfo(name = "name_en") val nameEn: String,
    @ColumnInfo(name = "name_he") val nameHe: String?,
    @ColumnInfo(name = "asciiname") val asciiname: String,
    @ColumnInfo(name = "country") val country: String,
    @ColumnInfo(name = "admin1") val admin1: String?,
)
