package com.fizz.business.controller;

import com.fizz.business.domain.LogData;
import com.fizz.business.form.LogDataForm;
import com.fizz.business.service.LogDataService;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.domain.R;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequiredArgsConstructor
@RequestMapping("/api/logdata" )
@Tag(name="日志管理")
@Anonymous
public class LogDataController {

    private final LogDataService logDataService;

    @Operation(summary = "历史记录")
    @PostMapping ("/list" )
    public R<PageInfo<LogData>> getLogDataPage(@RequestBody LogDataForm logDataForm) {
        return R.ok(logDataService.pageList(logDataForm));
    }

    @Operation(summary = "报警确认", description = "报警确认")
    @PatchMapping("/confirm/{seqid}" )
    //@PreAuthorize("@pms.hasPermission('business_log_data_edit')" )
    public R<?> alarmAck(@PathVariable Integer seqid) {
        logDataService.alarmAck(seqid);
        return R.ok();
    }
}
