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

import com.red.circle.common.business.dto.cmd.PageRoomIdCmd;
import com.red.circle.console.app.service.app.sys.SetHotRoomService;
import com.red.circle.console.infra.annotations.OpsOperationReqLog;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.inner.model.cmd.sys.SysHotRoomCmd;
import com.red.circle.other.inner.model.dto.sys.SysHotRoomDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
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.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author pengshigang on 2022/5/6
 */
@RestController
@RequiredArgsConstructor
@RequestMapping(value = "/sys-set-hot", produces = MediaType.APPLICATION_JSON_VALUE)
public class SysSetHotRoomRestController extends BaseController {

  private final SetHotRoomService setHotRoomService;

  /**
   * 分页列表.
   */
  @GetMapping("/page")
  public PageResult<SysHotRoomDTO> pageRoom(PageRoomIdCmd cmd) {
    return setHotRoomService.pageRoom(cmd);
  }

  @OpsOperationReqLog("添加或修改热门房间")
  @PostMapping("/add-or-update")
  public void addOrUpdate(@RequestBody @Validated SysHotRoomCmd param) {
    setHotRoomService.addOrUpdate(param);
  }

  /**
   * 移除房间.
   */
  @GetMapping("/remove")
  public void remove(@RequestParam() Long roomId) {
    setHotRoomService.remove(roomId);
  }

}
