package com.ruoyi.xq.controller;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.xq.dto.admin.unread.UnreadData;
import com.ruoyi.xq.manager.UnreadManager;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/xq/unread")
public class UnreadController {

    @Autowired
    public UnreadManager unreadManager;

    @GetMapping("/data")
    public R<UnreadData> list() {
        UnreadData data = unreadManager.data();
        return R.ok(data);
    }


    @GetMapping("/checkCount")
    public R<Integer> count() {
        boolean checkCount = unreadManager.checkCount();
        return R.ok(checkCount?1:0);
    }
}
