package com.amz.genie.services

import com.amz.genie.models.Login
import com.amz.genie.models.Message
import com.google.gson.annotations.SerializedName
import okhttp3.RequestBody
import retrofit2.Call
import retrofit2.http.Body
import retrofit2.http.DELETE
import retrofit2.http.Header
import retrofit2.http.POST
import retrofit2.http.Path

interface AuthServices {
    @POST("auth/refresh")
    fun refresh(
        @Header("Authorization") refreshAuthorization: String // "Bearer <refresh_token>"
    ): Call<RefreshResponse>

    @POST("login")
    fun login(
        @Body requestBody: RequestBody
    ): Call<Login>

    @DELETE("api/{path}")
    fun logoutDynamic(
        @Path("path") path: String,
        @Header("Authorization") token: String?
    ): Call<Message>
}

data class RefreshResponse(
    @SerializedName("access_token") val accessToken: String
)