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.device.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

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

    /**
     * 获取设备核心信息
     */
    @GetMapping("/{id}")
    CommonResponse<DeviceV2DTO> getDevice(@PathVariable("id") Long id);
    
    /**
     * 根据设备编号获取设备核心信息
     */
    @GetMapping("/no/{no}")
    CommonResponse<DeviceV2DTO> getDeviceByNo(@PathVariable("no") String no);

    /**
     * 创建设备
     */
    @PostMapping("/")
    CommonResponse<DeviceV2DTO> createDevice(@RequestBody CreateDeviceRequest request);
    
    /**
     * 更新设备
     */
    @PutMapping("/{id}")
    CommonResponse<String> updateDevice(@PathVariable("id") Long id, 
                                       @RequestBody UpdateDeviceRequest request);
    
    /**
     * 删除设备
     */
    @DeleteMapping("/{id}")
    CommonResponse<String> deleteDevice(@PathVariable("id") Long id);
    
    /**
     * 分页获取设备列表（核心信息）
     */
    @GetMapping("/")
    CommonResponse<PageResponse<DeviceV2DTO>> listDevices(
            @RequestParam(value = "page", defaultValue = "1") Integer page,
            @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
            @RequestParam(value = "name", required = false) String name,
            @RequestParam(value = "no", required = false) String no,
            @RequestParam(value = "type", required = false) String type,
            @RequestParam(value = "isActive", required = false) Integer isActive,
            @RequestParam(value = "scenicId", required = false) Long scenicId);

    /**
     * 根据配置条件筛选设备
     */
    @PostMapping("/filter-by-configs")
    CommonResponse<FilterDevicesByConfigsResponse> filterDevicesByConfigs(
            @RequestBody FilterDevicesByConfigsRequest request);
}