package com.pig4cloud.pig.admin.api.feign;

import com.pig4cloud.pig.admin.api.dto.SysPublicParamDTO;
import com.pig4cloud.pig.common.core.constant.ServiceNameConstants;
import com.pig4cloud.pig.common.core.util.R;
import com.pig4cloud.pig.common.feign.annotation.NoToken;
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;

import java.util.ArrayList;
import java.util.List;

/**
 * 远程参数服务接口
 * <p>
 * 通过Feign客户端调用UPMS服务获取参数配置
 * </p>
 *
 * @author lengleng
 * @date 2025/05/30
 * @see FeignClient
 */
@FeignClient(contextId = "remoteParamService", value = ServiceNameConstants.UPMS_SERVICE)
public interface RemoteParamService {

	/**
	 * 通过key 查询参数配置
	 * @param key key
	 * @NoToken 声明成内部调用，避免MQ 等无法调用
	 */
	@NoToken
	@GetMapping("/param/publicValue/{key}")
	R<String> getByKey(@PathVariable("key") String key);


	/**
	 * 通过key 修改公共参数值
	 * @param paramList 公共参数列表
	 * @NoToken 声明成内部调用，避免MQ 等无法调用
	 */
	@NoToken
	@PostMapping("/param/set")
	R<Boolean> setByKey(@RequestBody List<SysPublicParamDTO> paramList);

	@NoToken
	@PostMapping("/param/getList")
	R<ArrayList<SysPublicParamDTO>> getParamList(@RequestBody List<String> keyList);

}
