package com.ruoyi.ibs.dashboard.controller;

import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.ibs.dashboard.domain.dto.NotificationDTO;
import com.ruoyi.ibs.dashboard.domain.vo.NotificationVO;
import com.ruoyi.ibs.dashboard.service.NotificationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

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

/**
 * @Author 吴凯程
 * @Date 2025/4/2
 **/
@Api(tags = "消息通知接口")
@RestController
@RequestMapping("/notification")
public class NotificationController extends BaseController {

    @Resource
    private NotificationService notificationService;

    @ApiOperation("获取通知列表")
    @Log(title = "获取通知列表")
    @GetMapping("/list")
    public R<List<NotificationVO>> getNotificationList() {
        return R.ok(notificationService.getNotificationList()) ;
    }

    @ApiOperation("发送通知")
    @Log(title = "发送通知")
    @PostMapping("/send")
    public R<String> sendNotification(@RequestBody NotificationDTO notificationDTO) {
        return R.ok(notificationService.sendNotification(notificationDTO)) ;
    }

    @ApiOperation("通知已读")
    @Log(title = "通知已读")
    @PostMapping("/update")
    public R<String> sendNotification(@RequestParam String uuid) {
        return R.ok(notificationService.updateReadStatus(uuid)) ;
    }


}
