package space.nstart.pcp.complan.types

import com.fasterxml.jackson.annotation.JsonIgnoreProperties
import com.fasterxml.jackson.annotation.JsonProperty
import io.swagger.v3.oas.annotations.media.Schema
import java.time.LocalDate
import java.time.LocalDateTime
import java.util.UUID

@Schema(description = "Debug-запрос расчета greedy-математики по сохраненным параметрам наблюдения")
data class GreedyMathDebugRequestDTO(
    @get:JsonProperty("requestId")
    @param:JsonProperty("requestId")
    val requestId: UUID,

    @get:JsonProperty("satelliteIds")
    @param:JsonProperty("satelliteIds")
    val satelliteIds: List<Long>,

    @get:JsonProperty("calculationStart")
    @param:JsonProperty("calculationStart")
    val calculationStart: LocalDateTime,

    @get:JsonProperty("calculationEnd")
    @param:JsonProperty("calculationEnd")
    val calculationEnd: LocalDateTime,

    @get:JsonProperty("revolutionMode")
    @param:JsonProperty("revolutionMode")
    val revolutionMode: DynamicPlanRevolutionMode = DynamicPlanRevolutionMode.BOTH,

    @get:JsonProperty("filterCoveredRoutes")
    @param:JsonProperty("filterCoveredRoutes")
    val filterCoveredRoutes: Boolean = false
)

@Schema(description = "Выбранное greedy-включение без геометрии маршрута")
@JsonIgnoreProperties(ignoreUnknown = true)
data class GreedyMathCandidateDTO(
    @get:JsonProperty("intervalId")
    @param:JsonProperty("intervalId")
    val intervalId: UUID,

    @get:JsonProperty("regionId")
    @param:JsonProperty("regionId")
    val regionId: UUID,

    @get:JsonProperty("satelliteId")
    @param:JsonProperty("satelliteId")
    val satelliteId: Long,

    @get:JsonProperty("revolution")
    @param:JsonProperty("revolution")
    val revolution: Long,

    @get:JsonProperty("day")
    @param:JsonProperty("day")
    val day: LocalDate,

    @get:JsonProperty("timeBegin")
    @param:JsonProperty("timeBegin")
    val timeBegin: LocalDateTime,

    @get:JsonProperty("timeEnd")
    @param:JsonProperty("timeEnd")
    val timeEnd: LocalDateTime,

    @get:JsonProperty("durationSeconds")
    @param:JsonProperty("durationSeconds")
    val durationSeconds: Long,

    @get:JsonProperty("gamma")
    @param:JsonProperty("gamma")
    val gamma: Double
)

@Schema(description = "Debug-результат greedy-математики по сохраненным параметрам наблюдения")
@JsonIgnoreProperties(ignoreUnknown = true)
data class GreedyMathDebugResultDTO(
    @get:JsonProperty("requestId")
    @param:JsonProperty("requestId")
    val requestId: UUID,

    @get:JsonProperty("satelliteIds")
    @param:JsonProperty("satelliteIds")
    val satelliteIds: List<Long>,

    @get:JsonProperty("missingSatelliteIds")
    @param:JsonProperty("missingSatelliteIds")
    val missingSatelliteIds: List<Long>,

    @get:JsonProperty("calculationStart")
    @param:JsonProperty("calculationStart")
    val calculationStart: LocalDateTime,

    @get:JsonProperty("calculationEnd")
    @param:JsonProperty("calculationEnd")
    val calculationEnd: LocalDateTime,

    @get:JsonProperty("status")
    @param:JsonProperty("status")
    val status: ComplexPlanCalculationStatus,

    @get:JsonProperty("revolutionMode")
    @param:JsonProperty("revolutionMode")
    val revolutionMode: DynamicPlanRevolutionMode,

    @get:JsonProperty("observationParametersFilePath")
    @param:JsonProperty("observationParametersFilePath")
    val observationParametersFilePath: String? = null,

    @get:JsonProperty("intervalsCount")
    @param:JsonProperty("intervalsCount")
    val intervalsCount: Int,

    @get:JsonProperty("observationParametersCount")
    @param:JsonProperty("observationParametersCount")
    val observationParametersCount: Int,

    @get:JsonProperty("selectedCandidatesCount")
    @param:JsonProperty("selectedCandidatesCount")
    val selectedCandidatesCount: Int,

    @get:JsonProperty("failuresCount")
    @param:JsonProperty("failuresCount")
    val failuresCount: Int,

    @get:JsonProperty("selectedCandidates")
    @param:JsonProperty("selectedCandidates")
    val selectedCandidates: List<GreedyMathCandidateDTO>,

    @get:JsonProperty("filterCoveredRoutes")
    @param:JsonProperty("filterCoveredRoutes")
    val filterCoveredRoutes: Boolean,

    @get:JsonProperty("routesBeforeUsefulAreaFilterCount")
    @param:JsonProperty("routesBeforeUsefulAreaFilterCount")
    val routesBeforeUsefulAreaFilterCount: Int,

    @get:JsonProperty("routesAfterUsefulAreaFilterCount")
    @param:JsonProperty("routesAfterUsefulAreaFilterCount")
    val routesAfterUsefulAreaFilterCount: Int,

    @get:JsonProperty("routeBuildFailuresCount")
    @param:JsonProperty("routeBuildFailuresCount")
    val routeBuildFailuresCount: Int,

    @get:JsonProperty("greedySelectionMs")
    @param:JsonProperty("greedySelectionMs")
    val greedySelectionMs: Long,

    @get:JsonProperty("routeBuildMs")
    @param:JsonProperty("routeBuildMs")
    val routeBuildMs: Long,

    @get:JsonProperty("usefulAreaAnalysisMs")
    @param:JsonProperty("usefulAreaAnalysisMs")
    val usefulAreaAnalysisMs: Long,

    @get:JsonProperty("totalMs")
    @param:JsonProperty("totalMs")
    val totalMs: Long
)
