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

import com.red.circle.common.business.dto.cmd.PageRoomIdCmd;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.live.HotRoomClientService;
import com.red.circle.other.inner.endpoint.live.api.HotRoomClientApi;
import com.red.circle.other.inner.model.cmd.sys.RoomTopFixedCmd;
import com.red.circle.other.inner.model.cmd.sys.RoomTopFixedQryCmd;
import com.red.circle.other.inner.model.cmd.sys.SysHotRoomCmd;
import com.red.circle.other.inner.model.dto.sys.SysHotRoomDTO;
import com.red.circle.other.inner.model.dto.sys.SysTopRoomDTO;
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/7/24
 */
@Validated
@RestController
@RequestMapping(value = HotRoomClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class HotRoomClientEndpoint implements HotRoomClientApi {

  private final HotRoomClientService hotRoomClientService;

  @Override
  public ResultResponse<Void> addOrUpdate(SysHotRoomCmd param) {
    hotRoomClientService.addOrUpdate(param);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<Void> remove(Long roomId) {
    hotRoomClientService.remove(roomId);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<PageResult<SysHotRoomDTO>> pageRoom(PageRoomIdCmd cmd) {
    return ResultResponse.success(hotRoomClientService.pageRoom(cmd));
  }


  @Override
  public ResultResponse<PageResult<SysTopRoomDTO>> listRoomTop(RoomTopFixedQryCmd query) {
    return ResultResponse.success(hotRoomClientService.listRoomTop(query));
  }


  @Override
  public ResultResponse<Void> addOrUpdateRoomTop(RoomTopFixedCmd param) {
    hotRoomClientService.addOrUpdateRoomTop(param);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<Void> removeRoomTop(Long roomId) {
    hotRoomClientService.removeRoomTop(roomId);
    return ResultResponse.success();
  }

}
