package com.red.circle.console.adapter.app.game;

import com.red.circle.console.app.service.app.game.GameTrumpetBlackService;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.inner.model.cmd.game.GameTrumpetBlacklistParamCmd;
import com.red.circle.other.inner.model.cmd.game.GameTrumpetBlacklistQryCmd;
import com.red.circle.other.inner.model.dto.user.UserProfileDTO;
import lombok.AllArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 喇叭-黑名单 前端控制器.
 *
 * @author zongpubin on 2023-12-06 16:18
 */
@RestController
@AllArgsConstructor
@RequestMapping("/game-trumpet-blacklist")
public class GameTrumpetBlacklistRestController extends BaseController {

  private final GameTrumpetBlackService gameTrumpetBlackService;

  /**
   * 分页
   */
  @GetMapping("/page")
  public PageResult<UserProfileDTO> pageData(GameTrumpetBlacklistQryCmd query) {
    return gameTrumpetBlackService.page(query);
  }

  /**
   * 添加.
   */
  @PostMapping("/add")
  public void add(@RequestBody @Validated GameTrumpetBlacklistParamCmd param) {
    param.setCreateUser(getReqUserId());
    gameTrumpetBlackService.add(param);
  }

  /**
   * 删除.
   */
  @GetMapping("/delete/{userId}")
  public void deleteByUserId(@PathVariable("userId") Long userId) {
    gameTrumpetBlackService.deleteByUserId(userId);
  }


}
