package org.dueattendant149.bookshelf.data.remote.audiobookshelf

import okhttp3.ResponseBody
import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.Path
import retrofit2.http.Streaming

/**
 * Direct Audiobookshelf API calls for audio files and covers.
 * bookshelf-api does not proxy audio streams, so the app talks to ABS directly.
 */
interface AudiobookshelfApiService {

    @Streaming
    @GET("api/items/{itemId}/file/{fileId}")
    suspend fun downloadAudioFile(
        @Path("itemId") itemId: String,
        @Path("fileId") fileId: String,
    ): Response<ResponseBody>

    @Streaming
    @GET("api/items/{itemId}/download")
    suspend fun downloadBook(
        @Path("itemId") itemId: String,
    ): Response<ResponseBody>

    @GET("api/items/{itemId}/cover")
    suspend fun getCover(
        @Path("itemId") itemId: String,
    ): Response<ResponseBody>

    @GET("api/me/progress/{itemId}")
    suspend fun getProgress(
        @Path("itemId") itemId: String,
    ): Response<String>
}
