package com.usky.sas.controller.web;

import com.usky.common.core.bean.ApiResult;
import com.usky.sas.service.SasEventPriorityService;
import com.usky.sas.service.vo.EventPriorityConfigRequest;
import com.usky.sas.service.vo.EventPriorityConfigResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 事件优先级配置接口
 *
 * 对应 API 文档：
 * GET /prod-api/service-sas/event/priority
 * PUT /prod-api/service-sas/event/priority
 */
@RestController
@RequestMapping("/event/priority")
public class SasEventPriorityController {

    @Autowired
    private SasEventPriorityService eventPriorityService;

    @GetMapping
    public ApiResult<EventPriorityConfigResponse> getConfig() {
        return ApiResult.success(eventPriorityService.getConfig());
    }

    @PutMapping
    public ApiResult<Void> updateConfig(@RequestBody EventPriorityConfigRequest request) {
        eventPriorityService.updateConfig(request);
        return ApiResult.success();
    }
}

