package cn.iocoder.yudao.module.configure.api.deviceenvtype;

import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.module.configure.api.deviceenvtype.dto.DeviceEnvTypeCreateReqDTO;
import cn.iocoder.yudao.module.configure.api.deviceenvtype.dto.DeviceEnvTypeRespDTO;
import cn.iocoder.yudao.module.configure.api.deviceenvtype.dto.DeviceEnvTypeUpdateReqDTO;
import cn.iocoder.yudao.module.configure.enums.ApiConstants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

@FeignClient(name = ApiConstants.NAME) // TODO 芋艿：fallbackFactory =
@Api(tags = "RPC 服务 - 小程序设备环境类型配置")
@Validated
public interface DeviceEnvTypeApi {

    String PREFIX = ApiConstants.PREFIX + "/device-env-type";

    @PostMapping(PREFIX + "/createDeviceEnvTypeBatch")
    @ApiOperation("批量创建设备环境类型配置")
    @OperateLog(enable = false) // 不记录操作日志
    CommonResult<List<Long>> createDeviceEnvTypeBatch(@Valid @RequestBody List<DeviceEnvTypeCreateReqDTO> createReqDTOS);

    @PutMapping(PREFIX + "/updateDeviceEnvTypeBatch")
    @ApiOperation("批量更新设备环境类型配置")
    @OperateLog(enable = false) // 不记录操作日志
    CommonResult<Boolean> updateDeviceEnvTypeBatch(@Valid @RequestBody List<DeviceEnvTypeUpdateReqDTO> updateReqDTOS);

    @DeleteMapping(PREFIX + "/deleteDeviceEnvTypeBatch")
    @ApiOperation("批量删除设备环境类型配置")
    @ApiImplicitParam(name = "ids", value = "id集合", required = true, dataTypeClass = List.class)
    @OperateLog(enable = false) // 不记录操作日志
    CommonResult<Boolean> deleteDeviceEnvTypeBatch(@RequestParam("ids") List<Long> ids);

    @GetMapping(PREFIX + "/getByLandId")
    @ApiOperation("根据地块编码获取环境配置")
    @ApiImplicitParam(name = "landId", value = "地块id", required = true, dataTypeClass = String.class)
    @OperateLog(enable = false) // 不记录操作日志
    CommonResult<List<DeviceEnvTypeRespDTO>> getByLandId(@RequestParam("landId") String landId);

}
