package com.multictrl.modules.business.controller;

import com.multictrl.common.annotation.ApiOrder;
import com.multictrl.common.annotation.LogOperation;
import com.multictrl.common.utils.Result;
import com.multictrl.modules.business.service.DockSetService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.web.bind.annotation.*;

/**
 * 机场属性设置
 *
 * @author Sdy
 * @since 1.0.0 2026/6/17
 */
@RestController
@RequestMapping("business/dock/set")
@Tag(name = "机场属性设置")
@ApiOrder(25)
@RequiredArgsConstructor
public class DockSetController {
    private final DockSetService dockSetService;

    @Operation(summary = "空中回传（目前仅大疆机场三支持）")
    @PostMapping("/airTransfer/{dockSn}")
    @LogOperation("空中回传")
    @RequiresPermissions("bus:dockSet:airTransfer")
    public Result<Object> supplementLightClose(@PathVariable String dockSn,
                                               @Parameter(description = "空中回传开关 false:关闭,true:开启")
                                               @RequestParam Boolean enable) {
        return new Result<>().ok(dockSetService.setDockProperty(dockSn, "air_transfer_enable", enable));
    }

    @Operation(summary = "机场静音模式")
    @PostMapping("/silentMode/{dockSn}")
    @LogOperation("机场静音模式")
    @RequiresPermissions("bus:dockSet:silentMode")
    public Result<Object> supplementLightClose(@PathVariable String dockSn,
                                               @Parameter(description = "机场静音模式 0:非静音模式,1:静音模式")
                                               @RequestParam Integer value) {
        return new Result<>().ok(dockSetService.setDockProperty(dockSn, "silent_mode", value));
    }

    @Operation(summary = "用户体验改善计划")
    @PostMapping("/userExperienceImprovement/{dockSn}")
    @LogOperation("用户体验改善计划")
    @RequiresPermissions("bus:dockSet:userExperienceImprovement")
    public Result<Object> userExperienceImprovement(@PathVariable String dockSn,
                                                    @Parameter(description = "用户体验改善计划 0:初始状态,1:拒绝加入用户体验改善计划,2:同意加入用户体验改善计划")
                                                    @RequestParam Integer value) {
        return new Result<>().ok(dockSetService.setDockProperty(dockSn, "user_experience_improvement", value));
    }
}
