package com.jishisongfu.duobibi.data.api

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import retrofit2.http.Body
import retrofit2.http.POST

/**
 * AI 值不值得买 API。后端 `POST /api/v1/worth-buy`:输入商品 + 当前价 → 评分 + 建议。
 * 复用 [`@Named("llm")` 长超时 Retrofit](../../di/NetworkModule.kt)。
 */
interface WorthBuyApi {
    @POST("api/v1/worth-buy")
    suspend fun worthBuy(@Body req: WorthBuyRequest): WorthBuyResponse
}

@Serializable
data class WorthBuyRequest(
    val title: String,
    val price: Double,
    val platform: String? = null,
)

@Serializable
data class WorthBuyResponse(
    /** 0-100,越高越值得现在买 */
    val score: Int,
    /** "buy" / "wait" / "neutral" */
    val verdict: String,
    val headline: String,
    val reasons: List<String> = emptyList(),
    @SerialName("typical_price") val typicalPrice: Double,
    @SerialName("best_time") val bestTime: String = "",
)
