package cn.reghao.tnb.content.app.mall.feign;

import lombok.extern.slf4j.Slf4j;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author reghao
 * @date 2025-07-19 23:57:25
 */
@FeignClient(name = "user-service", fallback = UserFeignClient.UserFeignClientImpl.class)
public interface UserFeignClient {
    @GetMapping(value = "/api/user/hystrix/info", produces = MediaType.APPLICATION_JSON_VALUE)
    String getUserInfo(@RequestParam("userId") Long userId);

    @Slf4j
    @Component
    class UserFeignClientImpl implements UserFeignClient {
        @Override
        public String getUserInfo(Long userId) {
            log.info("getUserInfo fallback");
            return "";
        }
    }
}
