package com.bocloud.ims.booter.controller.resource;


import com.bocloud.ims.entity.resource.AlarmLevel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import com.bocloud.common.annotations.Log;
import com.bocloud.common.enums.BoCloudService;
import com.bocloud.common.model.BocloudResult;
import com.bocloud.common.utils.Common;
import com.bocloud.ims.interfaces.resource.AlarmLevelService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import java.util.List;

@Api(value = "告警级别", tags = "告警级别")
@RestController
@RequestMapping("/v1/quotas/thresholds")
public class AlarmLevelController {
	@Autowired
	private AlarmLevelService alarmLevelService;

	@ApiOperation(tags={"CMC","CSC"},value = "设置告警级别",  httpMethod = "POST")
	@Log(module = BoCloudService.IMS, target = "告警级别", operation = "设置告警级别")
	@PostMapping
	public BocloudResult<AlarmLevel> setting(@RequestBody AlarmLevel alarmLevel) {
		return alarmLevelService.setting(alarmLevel);
	}

	@ApiOperation(tags={"CMC","CSC"},value = "通过平台获取告警级别",  httpMethod = "GET")
	@Log(module = BoCloudService.IMS, target = "告警级别", operation = "通过平台获取告警级别")
	@GetMapping
	public BocloudResult<List<AlarmLevel>> getLevel(@RequestParam(value = Common.PARAMS) String params) {
		return alarmLevelService.getLevel(params);
	}
}
