package com.zksy.pole.controller;


import com.zksy.common.core.domain.Result;
import com.zksy.pole.domain.dto.*;
import com.zksy.pole.service.InstructionIssuanceServer;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author Administrator
 * @version 1.0
 * @project dh-server-micro
 * @description 指令下发
 * @date 2024/8/28 17:21:56
 */
@RestController
@RequestMapping("/instruct/issued")
@Api(tags = "指令下发", description = "指令下发 desc")
public class InstructionIssuanceController {
    @Autowired
    private InstructionIssuanceServer server;

    @ApiOperation(value = "灯具即时控制")
    @GetMapping(value = "/reportEnvironmentalData")
    public Result reportEnvironmentalData(ReportEnvironmentalDataDto dto){
        Result result = Result.ok(server.instructionIssuance(dto));
        return result;
    }

    @ApiOperation(value = "灯控设备状态查询和抄读网关场景策略")
    @GetMapping(value = "/equipmentStatus")
    public Result equipmentStatus(BaseDto dto){
        Result result = Result.ok(server.equipmentStatus(dto));
        return result;
    }

    @ApiOperation(value = "场景策略设置")
    @GetMapping(value = "/scenarioStrategy")
    public Result scenarioStrategy(ScenarioStrategyDto dto){
        Result result = Result.ok(server.scenarioStrategy(dto));
        return result;
    }

    @ApiOperation(value = "删除场景策略")
    @GetMapping(value = "/delScenarioStrategy")
    public Result delScenarioStrategy(DelScenarioStrategyDto dto){
        Result result = Result.ok(server.delScenarioStrategy(dto));
        return result;
    }

    @ApiOperation(value = "设置网关时间")
    @GetMapping("/setGatewayTime")
    public Result gatewayStrategy(SetGatewayTimeDto dto){
        Result result = Result.ok(server.setGatewayTime(dto));
        return result;
    }

    @ApiOperation(value = "服务器强制网关重新注册")
    @GetMapping(value = "/reRegistered")
    public Result reRegistered(BaseDto dto){
        Result result = Result.ok(server.reRegistered(dto));
        return result;
    }

    @ApiOperation(value = "继电器控制")
    @GetMapping(value = "/relayControl")
    public Result relayControl(RelayControlDto dto){
        Result result = Result.ok(server.relayControl(dto));
        return result;
    }

    @ApiOperation(value = "继电器定时策略设置")
    @GetMapping(value = "/relayTiming")
    public Result relayTiming(RelayTimingDto dto){
        Result result = Result.ok(server.relayTiming(dto));
        return result;
    }

    @ApiOperation(value = "删除继电器定时策略设置")
    @GetMapping(value = "/delRelayTiming")
    public Result delRelayTiming(DelRelayTimingDto dto){
        Result result = Result.ok(server.delRelayTiming(dto));
        return result;
    }

    @ApiOperation(value = "查询继电器定时策略设置")
    @GetMapping(value = "/queryRelayTiming")
    public Result queryRelayTiming(QueryRelayTimingDto dto){
        Result result = Result.ok(server.queryRelayTiming(dto));
        return result;
    }

}
