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.LocalDateTime
import java.util.UUID

@Schema(description = "Debug-запрос построения интервалов и расчета параметров наблюдения")
@JsonIgnoreProperties(ignoreUnknown = true)
data class ObservationParametersDebugRequestDTO(
    @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("parallelBallisticsCalculation")
    @param:JsonProperty("parallelBallisticsCalculation")
    val parallelBallisticsCalculation: Boolean = false,

    @get:JsonProperty("chunkSize")
    @param:JsonProperty("chunkSize")
    val chunkSize: Int? = null,

    @get:JsonProperty("parallelism")
    @param:JsonProperty("parallelism")
    val parallelism: Int? = null,

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

@Schema(description = "Debug-результат построения интервалов и расчета параметров наблюдения")
@JsonIgnoreProperties(ignoreUnknown = true)
data class ObservationParametersDebugResultDTO(
    @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("parallelBallisticsCalculation")
    @param:JsonProperty("parallelBallisticsCalculation")
    val parallelBallisticsCalculation: Boolean,

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

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

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

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

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

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

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

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

@Schema(description = "Файловый артефакт debug-расчета интервалов и параметров наблюдения")
@JsonIgnoreProperties(ignoreUnknown = true)
data class ObservationParametersDebugFileDTO(
    @get:JsonProperty("schemaVersion")
    @param:JsonProperty("schemaVersion")
    val schemaVersion: Int = 1,

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

    @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("parallelBallisticsCalculation")
    @param:JsonProperty("parallelBallisticsCalculation")
    val parallelBallisticsCalculation: Boolean,

    @get:JsonProperty("chunkSize")
    @param:JsonProperty("chunkSize")
    val chunkSize: Int?,

    @get:JsonProperty("parallelism")
    @param:JsonProperty("parallelism")
    val parallelism: Int?,

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

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

    @get:JsonProperty("intervals")
    @param:JsonProperty("intervals")
    val intervals: List<IntervalItemDTO>
)
