package com.ycwl.basic.integration.device.client;

import com.ycwl.basic.integration.common.response.CommonResponse;
import com.ycwl.basic.integration.common.response.PageResponse;
import com.ycwl.basic.integration.device.dto.defaults.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 默认配置管理 Feign 客户端
 */
@FeignClient(name = "zt-device", contextId = "device-default-config", path = "/api/device/config/v2/defaults")
public interface DefaultConfigClient {

    /**
     * 获取默认配置列表
     */
    @GetMapping
    CommonResponse<PageResponse<DefaultConfigResponse>> listDefaultConfigs(@RequestParam(value = "page", defaultValue = "1") int page,
                                                                          @RequestParam(value = "pageSize", defaultValue = "10") int pageSize);

    /**
     * 根据配置键获取默认配置
     */
    @GetMapping("/{configKey}")
    CommonResponse<DefaultConfigResponse> getDefaultConfig(@PathVariable("configKey") String configKey);

    /**
     * 创建默认配置
     */
    @PostMapping
    CommonResponse<String> createDefaultConfig(@RequestBody DefaultConfigRequest request);

    /**
     * 更新默认配置
     */
    @PutMapping("/{configKey}")
    CommonResponse<Map<String, Object>> updateDefaultConfig(@PathVariable("configKey") String configKey,
                                                           @RequestBody Map<String, Object> updates);

    /**
     * 删除默认配置
     */
    @DeleteMapping("/{configKey}")
    CommonResponse<String> deleteDefaultConfig(@PathVariable("configKey") String configKey);

    /**
     * 批量更新默认配置
     */
    @PostMapping("/batch")
    CommonResponse<BatchDefaultConfigResponse> batchUpdateDefaultConfigs(@RequestBody BatchDefaultConfigRequest request);
}