package com.alarm.controller;

import com.alarm.entity.Result;
import com.alarm.entity.alarm;
import com.alarm.service.alarmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/alarm")
public class alarmController {
    @Autowired
    private alarmService alarmService;

    @GetMapping("/query")
    public Result query(){
        List<List<String>> alarmList = alarmService.query();
        return Result.success(alarmList);
    }

    @GetMapping("/count")
    public Result countAll(){
        Integer count = alarmService.countAll();
        return Result.success(count);
    }

    @GetMapping("/count/{type}")
    public Result count(@PathVariable Integer type){
        Integer count = alarmService.count(type);
        return Result.success(count);
    }

    @GetMapping("/countTd")
    public Result countTd(){
        Integer count = alarmService.countTd();
        return Result.success(count);
    }
}
