package com.red.circle.other.app.inner.endpoint.live;

import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.live.RoomUserBlacklistClientService;
import com.red.circle.other.inner.endpoint.live.api.RoomUserBlacklistClientApi;
import com.red.circle.other.inner.model.cmd.live.RoomBlacklistQryCmd;
import com.red.circle.other.inner.model.dto.live.MicBlockDTO;
import com.red.circle.other.inner.model.dto.live.RoomUserBlacklistDTO;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 房间黑名单 服务控制器.
 *
 * @author pengliang on 2023/8/11
 */
@Validated
@RestController
@RequestMapping(value = RoomUserBlacklistClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class RoomUserBlacklistClientEndpoint implements RoomUserBlacklistClientApi {

  private final RoomUserBlacklistClientService roomUserBlacklistClientService;

  @Override
  public ResultResponse<Void> remove(Long roomId, Long cmdOriginUserId) {
    roomUserBlacklistClientService.removeBlack(roomId, cmdOriginUserId);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<Void> add(RoomUserBlacklistDTO dto) {
    roomUserBlacklistClientService.add(dto);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<List<RoomUserBlacklistDTO>> listOps(RoomBlacklistQryCmd qryCmd) {
    return ResultResponse.success(roomUserBlacklistClientService.listOps(qryCmd));
  }

  @Override
  public ResultResponse<Void> bannedLiveUser(MicBlockDTO dto) {
    roomUserBlacklistClientService.bannedLiveUser(dto);
    return ResultResponse.success();
  }

}
