package dev.adriankuta.flights.ui.home.sample

import androidx.compose.ui.tooling.preview.PreviewParameterProvider
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.ui.home.HomeUiState
import dev.adriankuta.flights.ui.home.PassengersState
import kotlinx.datetime.Clock
import kotlinx.datetime.TimeZone
import kotlinx.datetime.todayIn

internal class HomeUiStatePreviewParameterProvider : PreviewParameterProvider<HomeUiState> {

    private val mockAirports = listOf(
        AirportInfo(
            code = "WAW",
            name = "Warsaw Chopin Airport",
            seoName = "warsaw",
            isBase = true,
            timeZone = "Europe/Warsaw",
            city = City("WAW", "Warsaw"),
            macCity = MacCity("WARSAW"),
            region = Region("WARSAW_PL", "Warsaw"),
            country = Country("PL", "Poland", "PLN"),
            coordinates = Coordinates(52.1657, 20.9671),
        ),
        AirportInfo(
            code = "KRK",
            name = "Krakow Airport",
            seoName = "krakow",
            isBase = true,
            timeZone = "Europe/Warsaw",
            city = City("KRK", "Krakow"),
            macCity = MacCity("KRAKOW"),
            region = Region("KRAKOW_PL", "Krakow"),
            country = Country("PL", "Poland", "PLN"),
            coordinates = Coordinates(50.0777, 19.7848),
        ),
    )

    override val values: Sequence<HomeUiState> = sequenceOf(
        HomeUiState.Success(
            originAirports = mockAirports,
            destinationAirports = mockAirports,
            selectedOriginAirport = mockAirports.first(),
            selectedDestinationAirport = mockAirports.last(),
            selectedDate = Clock.System.todayIn(TimeZone.currentSystemDefault()),
            passengers = PassengersState(
                adultCount = 1,
                teenCount = 0,
                childCount = 0,
            ),
        ),
    )
}
