package dev.adriankuta.flights.model.repository.mappers

import dev.adriankuta.flights.domain.types.AirportInfo
import dev.adriankuta.flights.domain.types.City
import dev.adriankuta.flights.domain.types.Coordinates
import dev.adriankuta.flights.domain.types.Country
import dev.adriankuta.flights.domain.types.MacCity
import dev.adriankuta.flights.domain.types.Region
import dev.adriankuta.flights.model.datasource.airports.entities.AirportInfoModel

internal fun AirportInfoModel.toDomain(): AirportInfo {
    return AirportInfo(
        code = code,
        name = name,
        seoName = seoName,
        isBase = isBase,
        timeZone = timeZone,
        city = City(
            code = cityCode,
            name = cityName,
        ),
        macCity = MacCity(
            macCode = macCode,
        ),
        region = Region(
            code = regionCode,
            name = regionName,
        ),
        country = Country(
            code = countryCode,
            name = countryName,
            currencyCode = countryCurrencyCode,
        ),
        coordinates = Coordinates(
            latitude = latitude,
            longitude = longitude,
        ),
    )
}
