package com.ruoyi.controller;

import com.ruoyi.annotations.UserLoginToken;
import com.ruoyi.controller.req.ShieldPageReq;
import com.ruoyi.controller.req.ShieldUserReq;
import com.ruoyi.frequency.shield.service.ShieldService;
import com.ruoyi.response.ResponseData;
import com.ruoyi.vo.RyController;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * 屏蔽用户
 */
@CrossOrigin
@RestController
@RequestMapping("/api/shield")
@Api(tags = "屏蔽用户")
public class ApiShieldController extends RyController {

    @Autowired
    private ShieldService shieldService;

    /**
     * 屏蔽
     *
     * @return
     */
    @PostMapping("/shieldUser")
    @UserLoginToken
    public ResponseData shieldUser(@Valid @RequestBody ShieldUserReq req) {
        return shieldService.shieldUser(req, getUserVo());
    }

    /**
     * 屏蔽
     *
     * @return
     */
    @PostMapping("/shieldUserVersion2")
    @UserLoginToken
    public ResponseData shieldUserVersion2(@Valid @RequestBody ShieldUserReq req) {
        return shieldService.shieldUserVersion2(req, getUserVo());
    }

    /**
     * 取消屏蔽
     *
     * @return
     */
    @PostMapping("/cancelShieldUserVersion2")
    @UserLoginToken
    public ResponseData cancelShieldUserVersion2(@Valid @RequestBody ShieldUserReq req) {
        return shieldService.cancelShieldUserVersion2(req, getUserVo());
    }


    /**
     * 屏蔽列表
     *
     * @param req
     * @return
     */
    @PostMapping("/shieldPage")
    public ResponseData shieldPage(@RequestBody ShieldPageReq req) {
        return shieldService.shieldPage(req, getUserVo());
    }

    /**
     * 屏蔽列表(别人查看)
     *
     * @param req
     * @return
     */
    @PostMapping("/otherShieldPage")
    public ResponseData otherShieldPage(@RequestBody ShieldPageReq req) {
        return shieldService.otherShieldPage(req,getUserVo());
    }
}