package com.gyee.alarm.controller;


import com.gyee.alarm.model.vo.AlarmCustomTag;
import com.gyee.alarm.model.vo.AlarmSuperTalbeType;
import com.gyee.alarm.model.vo.AlarmTag;
import com.gyee.alarm.service.AlarmBtService;
import com.gyee.alarm.service.AlarmCtService;
import com.gyee.alarm.service.AlarmWtService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * 动态功率数据 前端控制器
 * </p>
 *
 * @author shilin
 * @since 2022-10-27
 */
@RestController
@RequestMapping("/api/alarm")
public class AlarmController {


    @Resource
    private AlarmWtService alarmWtService;

    @Resource
    private AlarmBtService alarmBtService;

    @Resource
    private AlarmCtService alarmCtService;

    @GetMapping("/wtTags")
    public List<AlarmTag> findTagsByWt()

    {
        List<AlarmTag> ls = alarmWtService.findTags(AlarmSuperTalbeType.WT.getCode());
        return ls;
    }

    @GetMapping("/btTags")
    public List<AlarmTag> findTagsByBt()

    {
        List<AlarmTag> ls = alarmBtService.findTags(AlarmSuperTalbeType.BT.getCode());
        return ls;
    }

    @GetMapping("/ctTags")
    public List<AlarmCustomTag> findTagsByCt()

    {
        List<AlarmCustomTag> ls = alarmCtService.findTags(AlarmSuperTalbeType.CT.getCode());
        return ls;
    }

    @PostMapping("/saveWtTags")
    public void saveWtTags(@RequestBody List<AlarmTag> alarms ) {
         alarmWtService.saveAlarms(alarms);
    }

    @PostMapping("/saveBtTags")
    public void saveBtTags(@RequestBody List<AlarmTag> alarms ) {
        alarmBtService.saveAlarms(alarms);
    }

    @PostMapping("/saveCtTags")
    public void saveCtTags(@RequestBody List<AlarmTag> alarms ) {
        alarmCtService.saveAlarms(alarms);
    }

}
