package pl.firmatpp.kierowca.data.upload

import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test

class RouteActionPhotoDependenciesTest {
    @Test
    fun detectsRouteActionWaitingForConfirmedPhotoClientRequest() {
        val action = action("""["photo-a","photo-b"]""")

        assertTrue(routeActionReferencesPhotoClientRequest(action, "photo-b"))
        assertFalse(routeActionReferencesPhotoClientRequest(action, "photo-c"))
    }

    @Test
    fun malformedPhotoRequestJsonDoesNotMatch() {
        assertFalse(routeActionReferencesPhotoClientRequest(action("not-json"), "photo-a"))
    }

    private fun action(photoClientRequestIdsJson: String): RouteActionEntity =
        RouteActionEntity(
            clientActionId = "action-1",
            routeId = "route-1",
            action = RouteActionType.Start,
            weight = 12.5,
            occurredAt = "2026-06-30T07:40:00Z",
            photoClientRequestIdsJson = photoClientRequestIdsJson,
            status = RouteActionStatus.WaitingForPhotos,
        )
}
