package dev.adriankuta.model.data.api.entities

import com.squareup.moshi.Json
import com.squareup.moshi.JsonClass

@JsonClass(generateAdapter = true)
data class FlightResponse(
    @Json(name = "currency") val currency: String?,
    @Json(name = "currPrecision") val currPrecision: Int?,
    @Json(name = "trips") val trips: List<Trip>?,
)

@JsonClass(generateAdapter = true)
data class Trip(
    @Json(name = "dates") val dates: List<TripDate>?,
    @Json(name = "origin") val origin: String?,
    @Json(name = "destination") val destination: String?,
)

@JsonClass(generateAdapter = true)
data class TripDate(
    @Json(name = "dateOut") val dateOut: String?,
    @Json(name = "flights") val flights: List<TripFlight>?,
)

@JsonClass(generateAdapter = true)
data class TripFlight(
    @Json(name = "faresLeft") val faresLeft: Int?,
    @Json(name = "regularFare") val regularFare: RegularFare?,
    @Json(name = "flightNumber") val flightNumber: String?,
    @Json(name = "time") val dateTimes: List<String>?,
    @Json(name = "duration") val duration: String?,
    @Json(name = "segments") val segments: List<Segment>?,
    @Json(name = "operatedBy") val operatedBy: String?,
)

@JsonClass(generateAdapter = true)
data class RegularFare(
    @Json(name = "fares") val fares: List<TripFare>?,
)

@JsonClass(generateAdapter = true)
data class TripFare(
    @Json(name = "type") val type: String?,
    @Json(name = "amount") val amount: Double?,
    @Json(name = "count") val count: Int?,
)

@JsonClass(generateAdapter = true)
data class Segment(
    @Json(name = "origin") val origin: String?,
    @Json(name = "destination") val destination: String?,
    @Json(name = "flightNumber") val flightNumber: String?,
    @Json(name = "time") val dateTimes: List<String>?,
    @Json(name = "duration") val duration: String?,
)
