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

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

import java.util.List;
import java.util.Map;

@FeignClient(name = "zt-device", contextId = "device-config-v2", path = "/api/device/config/v2")
public interface DeviceConfigV2Client {

    /**
     * 获取设备所有配置
     */
    @GetMapping("/{deviceId}")
    CommonResponse<List<DeviceConfigV2DTO>> getDeviceConfigs(@PathVariable("deviceId") Long deviceId);
    
    /**
     * 根据设备编号获取设备所有配置
     */
    @GetMapping("/no/{no}")
    CommonResponse<List<DeviceConfigV2DTO>> getDeviceConfigsByNo(@PathVariable("no") String no);
    
    /**
     * 获取设备特定配置
     */
    @GetMapping("/{deviceId}/key/{configKey}")
    CommonResponse<DeviceConfigV2DTO> getDeviceConfigByKey(@PathVariable("deviceId") Long deviceId,
                                                          @PathVariable("configKey") String configKey);

    /**
     * 创建设备配置
     */
    @PostMapping("/{deviceId}")
    CommonResponse<DeviceConfigV2DTO> createDeviceConfig(@PathVariable("deviceId") Long deviceId,
                                                        @RequestBody CreateDeviceConfigRequest request);
    
    /**
     * 更新设备配置
     */
    @PutMapping("/{deviceId}/{id}")
    CommonResponse<String> updateDeviceConfig(@PathVariable("deviceId") Long deviceId,
                                             @PathVariable("id") Long id,
                                             @RequestBody UpdateDeviceConfigRequest request);
    
    /**
     * 删除设备配置
     */
    @DeleteMapping("/{deviceId}/{id}")
    CommonResponse<String> deleteDeviceConfig(@PathVariable("deviceId") Long deviceId,
                                             @PathVariable("id") Long id);
    
    /**
     * 批量更新设备配置
     */
    @PostMapping("/{deviceId}/batch")
    CommonResponse<BatchUpdateResponse> batchUpdateDeviceConfig(@PathVariable("deviceId") Long deviceId,
                                                               @RequestBody BatchDeviceConfigRequest request);
    
}