import type { z } from "zod"

import type {
  citiesByCountrySchema,
  countriesSchema,
  locationsSchema,
} from "@/server/routers/hotels/output"

export interface LocationSchema extends z.output<typeof locationsSchema> {}

export type Location = LocationSchema["data"][number]

export type CityLocation = Location & { type: "cities" }
export type HotelLocation = Location & { type: "hotels" }

export function isHotelLocation(
  location: Location | null
): location is HotelLocation {
  return location?.type === "hotels"
}
export interface CitiesByCountry
  extends z.output<typeof citiesByCountrySchema> {}
export type CitiesGroupedByCountry = Record<string, CitiesByCountry["data"]>

export interface Countries extends z.output<typeof countriesSchema> {}
