package org.nstart.dep265.requestservice.mapper

import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import space.nstart.pcp.pcp_types_lib.dto.routes.AngleRangeDto
import space.nstart.pcp.pcp_types_lib.dto.routes.RoutePassportDto
import java.math.BigDecimal
import java.time.LocalDateTime
import java.util.UUID

class RoutePassportMapperTest {
    private val mapper = RoutePassportMapper()

    @Test
    fun `should convert route roll angle to absolute range`() {
        val routePassportDto = RoutePassportDto(
            routeId = UUID.fromString("51b07d12-1823-4bd5-b55d-de02a5304c03"),
            kaShort = "S1A",
            kaFull = "sentinel-1a",
            routeNameFull = "ROUTE-001",
            routeNameShort = "S1A-GRDH",
            orbitNumber = 59796L,
            orbitState = "Descending",
            intervalBegin = LocalDateTime.of(2026, 4, 1, 10, 15, 0),
            intervalEnd = LocalDateTime.of(2026, 4, 1, 10, 16, 30),
            rollAngle = AngleRangeDto(
                min = BigDecimal("-5.0"),
                max = BigDecimal("12.0"),
            ),
            visirAngle = AngleRangeDto(
                min = BigDecimal("21.0"),
                max = BigDecimal("24.5"),
            ),
            resolutionRange = BigDecimal("10.0"),
            resolutionAzimuth = BigDecimal("10.0"),
            polarisation = listOf("VH", "VV"),
            processingLevel = "GRD",
            geometry = "POLYGON((0 0, 1 0, 1 1, 0 0))",
        )

        val route = mapper.toRouteDto(routePassportDto)

        assertEquals(0.0, route.rollAngle.min)
        assertEquals(12.0, route.rollAngle.max)
    }
}
