package shop.alien.store.feign;

import com.fasterxml.jackson.databind.JsonNode;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;

@FeignClient(url = "${feign.alienAI.url}", name = "alien-AI")
public interface AlienAIFeign {

    /**
     * 登录接口 - 获取access_token
     *
     *
     *
     * @return JsonNode 响应体，包含access_token
     */
    @PostMapping(value = "/ai/user-auth-core/api/v1/auth/login",
            consumes = MediaType.MULTIPART_FORM_DATA_VALUE,
            produces = MediaType.APPLICATION_JSON_VALUE)
    JsonNode login(@RequestBody MultiValueMap<String, String> formData);

    /**
     * 使用 JsonNode 灵活调用接口
     *
     * @param authorization Bearer token，格式为 "Bearer {access_token}"
     * @return JsonNode 响应体，可以灵活解析
     */
    @PostMapping(value = "/asr/upload",
            consumes = MediaType.MULTIPART_FORM_DATA_VALUE,
            produces = MediaType.APPLICATION_JSON_VALUE)
    JsonNode getSpeechRecognition (@RequestHeader("Authorization") String authorization, @RequestBody MultiValueMap<String, Object> formData);
}

