package org.dromara.web.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.web.domain.bo.LongTermManagementExecuteBo;
import org.dromara.web.domain.bo.LongTermManagementListPageBo;
import org.dromara.web.domain.bo.LongTermManagementStopBo;
import org.dromara.web.domain.vo.LongTermManagementListPageVo;
import org.dromara.web.service.LongTermManagementService;
import org.springframework.web.bind.annotation.*;

/**
 * @Author: Huanyi
 * @CreateTime: 2025-08-25
 * @Description:
 * @Version: 1.0
 */

@RestController
@RequestMapping("/longTerm/management")
@RequiredArgsConstructor
public class LongTermManagementInstructionsController {

    private final LongTermManagementService longTermManagementService;

    @GetMapping("/list")
    @SaCheckPermission("workbench:long:list")
    public TableDataInfo<LongTermManagementListPageVo> listPage(LongTermManagementListPageBo bo, PageQuery pageQuery) {
        return longTermManagementService.listPage(bo, pageQuery);
    }

    @PutMapping("/execute")
    @SaCheckPermission("workbench:long:execute")
    public R execute(@RequestBody LongTermManagementExecuteBo bo) {
        return longTermManagementService.execute(bo);
    }

    @PutMapping("/stop")
    @SaCheckPermission("workbench:long:stop")
    public R stop(@RequestBody LongTermManagementStopBo bo) {
        return longTermManagementService.stop(bo);
    }

}
