package com.hz.pm.api.sys.controller;

import com.ningdatech.log.annotation.WebLog;
import com.hz.pm.api.sys.manage.CpuManage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * @Classname CpuController
 * @Description
 * @Date 2023/10/30 11:06
 * @Author PoffyZhang
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/api/v1/cpu")
@Api(value = "CpuController", tags = "CPU提升和关闭提升")
@RequiredArgsConstructor
public class CpuController {

    private final CpuManage cpuManage;

    @ApiOperation(value = "提升cpu 增加一个线程", notes = "提升cpu 增加一个线程")
    @PostMapping("/high")
    @WebLog("提升cpu")
    public String high() {
        cpuManage.high();
        return "提高成功";
    }

    @ApiOperation(value = "关闭提升cpu", notes = "关闭提升cpu")
    @PostMapping("/close")
    @WebLog("关闭提升cpu")
    public String close() {
        cpuManage.close();
        return "关闭成功";
    }
}
