package com.kt.event.content.infra.gateway.client;

import com.kt.event.content.infra.gateway.client.dto.ReplicateRequest;
import com.kt.event.content.infra.gateway.client.dto.ReplicateResponse;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * Replicate API FeignClient
 *
 * Stable Diffusion 이미지 생성을 위한 Replicate API 클라이언트
 * - API Docs: https://replicate.com/docs/reference/http
 * - 인증: Authorization: Token {api_token}
 */
@FeignClient(
        name = "replicate-api",
        url = "${replicate.api.url:https://api.replicate.com}",
        configuration = ReplicateApiConfig.class
)
public interface ReplicateApiClient {

    /**
     * 예측 생성 (이미지 생성 요청)
     *
     * POST /v1/predictions
     *
     * @param request 이미지 생성 요청 (모델 버전, 프롬프트 등)
     * @return 예측 응답 (예측 ID, 상태)
     */
    @PostMapping("/v1/predictions")
    ReplicateResponse createPrediction(@RequestBody ReplicateRequest request);

    /**
     * 예측 상태 조회
     *
     * GET /v1/predictions/{prediction_id}
     *
     * @param predictionId 예측 ID
     * @return 예측 응답 (상태, 결과 이미지 URL 등)
     */
    @GetMapping("/v1/predictions/{prediction_id}")
    ReplicateResponse getPrediction(@PathVariable("prediction_id") String predictionId);
}
