package space.nstart.pcp.pcp_request_service.model

import ballistics.utils.toDateTime
import space.nstart.pcp.pcp_types_lib.dto.ballistics.RevolutionSign
import space.nstart.pcp.pcp_types_lib.dto.ballistics.SquareViewParamDTO
import kotlin.math.PI

data class SquareViewParamsModel(
    var id: Long = 0,
    var objID : String,
    var pointNumb: Int = 0,
    var vitN: Int = 0,
    var tN: Double = 0.0,
    var pvN : RevolutionSign = RevolutionSign.ASC,
    var vitK: Int = 0,
    var tK: Double = 0.0,
    var pvK: RevolutionSign = RevolutionSign.ASC,
    var krenMin: Double = 0.0,
    var krenMax: Double = 0.0
): Cloneable {

    fun toDTO(): SquareViewParamDTO =
        SquareViewParamDTO(
            this.id,
            this.objID,
            this.vitN.toLong(),
            toDateTime(this.tN),
            this.pvN,
            this.vitK.toLong(),
            toDateTime(this.tK),
            this.pvK,
            this.krenMin * 180 / PI,
            this.krenMax * 180 / PI,
        )

    public override fun clone(): SquareViewParamsModel {
        return super.clone() as SquareViewParamsModel
    }
}