package com.mx.cneeds.server.datashow.client;

import com.mx.cneeds.common.dto.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
import java.util.Set;

/**
 * @ClassName DeviceClient
 * @Author zzrdark
 * @Date 2020-03-18 15:57
 * @Description TODO
 **/
@FeignClient(name = "CNEEDS-SERVER-DEVICE")
public interface DeviceClient {

    @PostMapping("/device/series/list")
    PageDto seriesList(@RequestParam Integer page,
                       @RequestParam("limit") Integer pageSize,
                       @RequestParam("sidx") String orderField,
                       @RequestParam("order") String order,
                       @RequestParam("seriesNum") String seriesNum);

    @PostMapping("/device/series/listAll")
    List<SeriesDto> seriesListAll();

    @PostMapping("/device/series/save")
    void addSeries(@RequestBody SeriesDto dto);

    @PostMapping("/device/series/querySeriesDto")
    SeriesDto querySeries(@RequestBody String seriesNum);

    @PostMapping("/device/series/update")
    void updateSeries(@RequestBody SeriesDto dto);

    @PostMapping("/device/series/delete")
    void deleteSeries(@RequestBody List<Long> ids);


    @PostMapping("device/info/list")
    PageDto deviceList(@RequestParam Integer page,
                       @RequestParam("limit") Integer pageSize,
                       @RequestParam("sidx") String orderField,
                       @RequestParam("order") String order,
                       @RequestParam("seriesId") Long seriesId,
                       @RequestParam("imei") String imei);

    @PostMapping("/device/info/infoByImei")
    DeviceInfoDto queryDeviceByImei(@RequestBody String imei);

    @PostMapping("/device/info/infoByImeis")
    List<DeviceInfoDto> queryDeviceByImeis(@RequestBody List<String> imeis);

    @PostMapping("/device/info/infoByIds")
    List<DeviceInfoDto> queryDeviceByIds(@RequestBody Set<Long> ids);

    @PostMapping("/device/info/importDevice")
    void importDevice(@RequestBody DevicesDto dto);

    @PostMapping("/device/info/updateDeviceChannelBatch")
    void updateDeviceChannelBatch(@RequestBody DevicesDto dto);

    @PostMapping("/device/info/updateDeviceSeriesBatch")
    void updateDeviceSeriesBatch(@RequestBody DevicesDto dto);

    @PostMapping("/device/info/updateByImei")
    void updateDevice(@RequestBody DeviceInfoDto dto);

    @PostMapping("/device/info/delete")
    void deleteDevice(@RequestBody List<Long> ids);

    @PostMapping("/device/info/uploadDeivceChannelExcel")
    void uploadDeivceChannelExcel(@RequestBody UploadDeviceChannelExcelDto dto);


    @PostMapping("/device/info/uploadDeivceExcel")
    void uploadDeivceExcel(@RequestBody UploadDeviceChannelExcelDto dto);



    @PostMapping("/device/devicechannel/list")
    PageDto deviceChannelList(@RequestParam Integer page,
                              @RequestParam("limit") Integer pageSize,
                              @RequestParam("sidx") String orderField,
                              @RequestParam("order") String order,
                              @RequestParam("channelNum") String channelNum);
    /**
     * 增加一个渠道号
     * @param dto
     */
    @PostMapping("/device/devicechannel/save")
    void addDeviceChannel(@RequestBody DeviceChannelDto dto);

    @PostMapping("/device/devicechannel/queryDeviceChannel")
    DeviceChannelDto queryDeviceChannel(@RequestBody String channelNum);

    @PostMapping("/device/devicechannel/update")
    void updateDeviceChannel(@RequestBody DeviceChannelDto dto);

    @PostMapping("/device/devicechannel/delete")
    void deleteDeviceChannels(@RequestBody List<Long> ids);

    @PostMapping("/device/devicechannel/queryDeviceChannelAll")
    List<DeviceChannelDto> queryDeviceChannelAll();

    @PostMapping("/device/devicechannel/deleteSettingDeviceChannel")
    void deleteSettingDeviceChannel(@RequestBody Long deviceId);

    @PostMapping("/device/devicechannel/updateSettingDeviceChannel")
    void updateSettingDeviceChannel(@RequestBody DeviceInfoDto dto);

    @PostMapping("/device/devicechannel/queryTotalStatisticsDeviceChannel")
    List<DeviceChannelStatisticsDto> queryTotalStatisticsDeviceChannel(@RequestBody(required = false) List<Long> channelIds);

    @PostMapping("/device/devicechannel/deleteStatisticsDeviceChannel")
    void deleteStatisticsDeviceChannel(@RequestBody StatisticsDeviceChannelDto dto);

    @PostMapping("/device/info/queryDeviceChannelSetting")
    List<String> queryDeviceChannelSetting(List<String> imeis);


    @PostMapping("device/info/deviceInfoExportList")
    PageDto deviceInfoExportList(@RequestParam Integer page,
                       @RequestParam("limit") Integer pageSize,
                       @RequestParam("sidx") String orderField,
                       @RequestParam("order") String order,
                       @RequestParam("seriesId") Long seriesId);

    @PostMapping("device/info/addDeviceInfoExport")
    void addDeviceInfoExport(@RequestBody DeviceInfoExportDto deviceInfoExportDto);

    @PostMapping("device/info/deleteDeviceInfoExport")
    void deleteDeviceInfoExport(@RequestBody Long deviceInfoExportId);

    @PostMapping("device/info/deleteDeviceInfoExportByName")
    void deleteDeviceInfoExportByName(@RequestBody String fileName);


    @PostMapping("/device/devicecartype/list")
    PageDto DeviceCarTypeList(@RequestParam Integer page,
                       @RequestParam("limit") Integer pageSize,
                       @RequestParam("sidx") String orderField,
                       @RequestParam("order") String order);

    @PostMapping("/device/devicecartype/queryDeviceCarTypeAll")
    List<DeviceCarTypeDto> queryDeviceCarTypeAll();

    @PostMapping("/device/devicecartype/save")
    void addDeviceCarType(@RequestBody DeviceCarTypeDto dto);

    @PostMapping("/device/devicecartype/update")
    void updateDeviceCarType(@RequestBody DeviceCarTypeDto dto);

    @PostMapping("/device/devicecartype/delete")
    void deleteDeviceCarType(@RequestBody List<Long> carTypeIds);

    @PostMapping("/device/devicelinkprotocols/list")
    PageDto DeviceLinkProtocolsList(@RequestParam Integer page,
                              @RequestParam("limit") Integer pageSize,
                              @RequestParam("sidx") String orderField,
                              @RequestParam("order") String order);

    @PostMapping("/device/devicelinkprotocols/save")
    void addDeviceLinkProtocols(@RequestBody DeviceLinkProtocolsDto dto);

    @PostMapping("/device/devicelinkprotocols/update")
    void updateDeviceLinkProtocols(@RequestBody DeviceLinkProtocolsDto dto);

    @PostMapping("/device/devicelinkprotocols/delete")
    void deleteDeviceLinkProtocols(@RequestBody List<Long> linkProtocolsIds);

}
