package pl.firmatpp.kierowca.data.api

import okhttp3.MultipartBody
import okhttp3.RequestBody
import pl.firmatpp.kierowca.data.model.BootstrapResponse
import pl.firmatpp.kierowca.data.model.OtpResponse
import pl.firmatpp.kierowca.data.model.PhotoUploadResponse
import pl.firmatpp.kierowca.data.model.RequestOtpBody
import pl.firmatpp.kierowca.data.model.RouteResponse
import pl.firmatpp.kierowca.data.model.VerifyOtpBody
import pl.firmatpp.kierowca.data.model.VerifyOtpResponse
import retrofit2.http.Body
import retrofit2.http.GET
import retrofit2.http.Header
import retrofit2.http.Multipart
import retrofit2.http.POST
import retrofit2.http.Part
import retrofit2.http.Path
import retrofit2.http.Query

interface MobileDriverApi {
    @POST("mobile/driver/auth/request-otp")
    suspend fun requestOtp(@Body body: RequestOtpBody): OtpResponse

    @POST("mobile/driver/auth/verify-otp")
    suspend fun verifyOtp(@Body body: VerifyOtpBody): VerifyOtpResponse

    @POST("mobile/driver/auth/logout")
    suspend fun logout(@Header("Authorization") authorization: String): Map<String, Boolean>

    @GET("mobile/driver/bootstrap")
    suspend fun bootstrap(
        @Header("Authorization") authorization: String,
        @Query("date") date: String?,
    ): BootstrapResponse

    @GET("mobile/driver/routes/{routeId}")
    suspend fun route(
        @Header("Authorization") authorization: String,
        @Path("routeId") routeId: String,
    ): RouteResponse

    @Multipart
    @POST("mobile/driver/routes/{routeId}/photos")
    suspend fun uploadPhoto(
        @Header("Authorization") authorization: String,
        @Path("routeId") routeId: String,
        @Part photo: MultipartBody.Part,
        @Part("source") source: RequestBody,
        @Part("takenAt") takenAt: RequestBody?,
        @Part("latitude") latitude: RequestBody?,
        @Part("longitude") longitude: RequestBody?,
        @Part("locationAccuracyMeters") locationAccuracyMeters: RequestBody?,
    ): PhotoUploadResponse
}
