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

import de.oaa.xxx.app.data.model.ConversationSummary
import de.oaa.xxx.app.data.model.CountResponse
import de.oaa.xxx.app.data.model.FriendshipDto
import de.oaa.xxx.app.data.model.MessageDto
import de.oaa.xxx.app.data.model.PinnwandEintragDto
import de.oaa.xxx.app.data.model.User
import de.oaa.xxx.app.data.model.UserProfile
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 SocialApi {

    // --- User profiles ---
    @GET("social/users/{userId}")
    suspend fun getUserProfile(@Path("userId") userId: String): Response<UserProfile>

    @GET("social/users/search")
    suspend fun searchUsers(@Query("q") query: String): Response<List<User>>

    // --- Friends ---
    @POST("social/friends/request")
    suspend fun sendFriendRequest(@Body body: Map<String, String>): Response<Unit>

    @POST("social/friends/accept")
    suspend fun acceptFriendRequest(@Body body: Map<String, String>): Response<Unit>

    @DELETE("social/friends/reject")
    suspend fun rejectFriend(@Body body: Map<String, String>): Response<Unit>

    @GET("social/friends")
    suspend fun getFriends(): Response<List<FriendshipDto>>

    @GET("social/friends/pending")
    suspend fun getPendingRequests(): Response<List<FriendshipDto>>

    @GET("social/friends/pending/count")
    suspend fun getPendingCount(): Response<CountResponse>

    // --- Messages ---
    @POST("social/messages")
    suspend fun sendMessage(@Body body: Map<String, String>): Response<Unit>

    @GET("social/messages")
    suspend fun getConversations(): Response<List<ConversationSummary>>

    @GET("social/messages/unread/count")
    suspend fun getUnreadCount(): Response<CountResponse>

    @GET("social/messages/{partnerId}")
    suspend fun getConversation(@Path("partnerId") partnerId: String): Response<List<MessageDto>>

    // --- Pinnwand ---
    @GET("social/pinnwand/{userId}")
    suspend fun getPinnwand(@Path("userId") userId: String): Response<List<PinnwandEintragDto>>

    @POST("social/pinnwand/{userId}")
    suspend fun createPinnwandEintrag(
        @Path("userId") userId: String,
        @Body body: Map<String, String>
    ): Response<Unit>

    @DELETE("social/pinnwand/{eintragId}")
    suspend fun deletePinnwandEintrag(@Path("eintragId") eintragId: String): Response<Unit>
}
