package com.fuyuanshen.app.controller.device.bjq;

import com.fuyuanshen.app.domain.vo.AppDeviceHBY100JDetailVo;
import com.fuyuanshen.common.core.domain.R;
import com.fuyuanshen.common.web.core.BaseController;
import com.fuyuanshen.web.controller.device.domain.dto.*;
import com.fuyuanshen.web.service.device.DeviceHBY100JBizService;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * HBY100J设备控制类
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/app/hby100j/device")
public class AppDeviceHBY100JController extends BaseController {

    private final DeviceHBY100JBizService deviceHBY100JBizService;


    /**
     * 获取设备详细信息
     *
     * @param id 主键
     */
    @GetMapping("/{id}")
    public R<AppDeviceHBY100JDetailVo> getInfo(@NotNull(message = "主键不能为空")
                                             @PathVariable Long id) {
        return R.ok(deviceHBY100JBizService.getInfo(id));
    }

    /**
     * 更新语音
     */
    @PostMapping("/updateVoice")
    public R<Void> updateVoice(@RequestBody HBY100JUpdateVoiceDto dto) {
        deviceHBY100JBizService.updateVoice(dto);
        return R.ok();
    }

    /**
     * 强制报警
     *
     */

    @PostMapping("/forceAlarmActivation")
    public R<Void> forceAlarmActivation(@RequestBody HBY100JForceAlarmActivationDto bo) {
        deviceHBY100JBizService.forceAlarmActivation(bo);
        return R.ok();
    }

    /**
     * 语音播报
     *
     */
    @PostMapping("/voiceBroadcast")
    public R<Void> voiceBroadcast(@RequestBody HBY100JVoiceBroadcastDto params) {
        deviceHBY100JBizService.voiceBroadcast(params);
        return R.ok();
    }


    /**
     * 爆闪模式
     */
    @PostMapping("/strobeMode")
    public R<Void> strobeMode(@RequestBody HBY100JStrobeModeDto params) {
        deviceHBY100JBizService.strobeMode(params);
        return R.ok();
    }


    /**
     * 灯光调节
     */
    @PostMapping("/lightAdjustment")
    public R<Void> lightAdjustment(@RequestBody HBY100JLightAdjustmentDto params) {
        deviceHBY100JBizService.lightAdjustment(params);
        return R.ok();
    }


    /**
     * 爆闪频率
     */
    @PostMapping("/strobeFrequency")
    public R<Void> strobeFrequency(@RequestBody HBY100JStrobeFrequencyDto params) {
        deviceHBY100JBizService.strobeFrequency(params);
        return R.ok();
    }

    /**
     * 修改音量
     */
    @PostMapping("/updateVolume")
    public R<Void> updateVolume(@RequestBody HBY100JUpdateVolumeDto params) {
        deviceHBY100JBizService.updateVolume(params);
        return R.ok();
    }
}
