package space.nstart.pcp.pcp_satellite_catalog_service.entity

import jakarta.persistence.Column
import jakarta.persistence.Entity
import jakarta.persistence.Id
import jakarta.persistence.Table
import space.nstart.pcp.pcp_types_lib.dto.satellite.SatelliteObservationProfileDTO

@Entity
@Table(name = "satellite_observation_profile")
class SatelliteObservationProfileEntity(
    @Id
    @Column(name = "satellite_id")
    val satelliteId: Long = 0,
    @Column(name = "capture_angle", nullable = false)
    val captureAngle: Double = 1.5,
    @Column(name = "sun_angle_min", nullable = false)
    val sunAngleMin: Double = -90.0,
    @Column(name = "duration_min_seconds", nullable = false)
    val durationMinSeconds: Long = 10,
    @Column(name = "duration_max_seconds", nullable = false)
    val durationMaxSeconds: Long = 300,
    @Column(name = "mmi_seconds", nullable = false)
    val mmiSeconds: Long = 10,
    @Column(name = "daily_max_duration_seconds", nullable = false)
    val dailyMaxDurationSeconds: Long = 35 * 60,
    @Column(name = "revolution_max_duration_seconds", nullable = false)
    val revolutionMaxDurationSeconds: Long = 5 * 60
) {
    fun toDTO() = SatelliteObservationProfileDTO(
        captureAngle = captureAngle,
        sunAngleMin = sunAngleMin,
        durationMinSeconds = durationMinSeconds,
        durationMaxSeconds = durationMaxSeconds,
        mmiSeconds = mmiSeconds,
        dailyMaxDurationSeconds = dailyMaxDurationSeconds,
        revolutionMaxDurationSeconds = revolutionMaxDurationSeconds
    )
}
