package de.oaa.xxx.app.data.api

import de.oaa.xxx.app.data.model.FeedItemDto
import de.oaa.xxx.app.data.model.FeedPostRequest
import retrofit2.Response
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.GET
import retrofit2.http.POST
import retrofit2.http.Path
import retrofit2.http.Query

interface FeedApi {

    @POST("feed/posts")
    suspend fun createPost(@Body request: FeedPostRequest): Response<FeedItemDto>

    @GET("feed/mine")
    suspend fun getMyFeed(
        @Query("page") page: Int = 0,
        @Query("size") size: Int = 20
    ): Response<List<FeedItemDto>>

    @GET("feed/public")
    suspend fun getPublicFeed(
        @Query("page") page: Int = 0,
        @Query("size") size: Int = 20
    ): Response<List<FeedItemDto>>

    @GET("feed/user/{userId}")
    suspend fun getUserFeed(
        @Path("userId") userId: String,
        @Query("page") page: Int = 0,
        @Query("size") size: Int = 20
    ): Response<List<FeedItemDto>>

    @POST("feed/posts/{id}/like")
    suspend fun toggleLike(@Path("id") id: String): Response<Unit>

    @POST("feed/posts/{id}/vote")
    suspend fun vote(@Path("id") id: String, @Body body: Map<String, String>): Response<Unit>

    @DELETE("feed/posts/{id}")
    suspend fun deletePost(@Path("id") id: String): Response<Unit>
}
