package com.jishisongfu.duobibi.data.api

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

/**
 * 比价擂台 API。后端 `POST /api/v1/arena-quote`:输入商品名 → LLM 估各平台到手价 + 市场常见价。
 * 复用 [`@Named("llm")` 长超时 Retrofit](../../di/NetworkModule.kt)。
 */
interface ArenaApi {
    @POST("api/v1/arena-quote")
    suspend fun arenaQuote(@Body req: ArenaQuoteRequest): ArenaQuoteResponse
}

@Serializable
data class ArenaQuoteRequest(
    val title: String,
    /** 不传则后端用默认 4 大电商 */
    val platforms: List<String>? = null,
)

@Serializable
data class ArenaPlatformQuote(
    val platform: String,
    val price: Double,
    val note: String = "",
)

@Serializable
data class ArenaQuoteResponse(
    val title: String,
    @SerialName("typical_price") val typicalPrice: Double,
    val quotes: List<ArenaPlatformQuote> = emptyList(),
    @SerialName("lowest_platform") val lowestPlatform: String? = null,
)
