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

enum class DynamicPlanRunStatus {
    PENDING,
    RUNNING,
    COMPLETED,
    FAILED
}

@Schema(description = "Состояние запуска расчета динамического плана")
@JsonIgnoreProperties(ignoreUnknown = true)
data class DynamicPlanRunDTO(
    @get:JsonProperty("runId")
    @param:JsonProperty("runId")
    val runId: UUID,

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

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

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

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

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

    @get:JsonProperty("startedAt")
    @param:JsonProperty("startedAt")
    val startedAt: LocalDateTime?,

    @get:JsonProperty("finishedAt")
    @param:JsonProperty("finishedAt")
    val finishedAt: LocalDateTime?,

    @get:JsonProperty("durationMs")
    @param:JsonProperty("durationMs")
    val durationMs: Long?,

    @get:JsonProperty("resultStatus")
    @param:JsonProperty("resultStatus")
    val resultStatus: String?,

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

    @get:JsonProperty("errorMessage")
    @param:JsonProperty("errorMessage")
    val errorMessage: String?
)
