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

import com.red.circle.common.business.dto.cmd.IdLongCmd;
import com.red.circle.console.app.service.app.game.GameKtvGiftConfigService;
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.game.GameKtvGiftConfigQryCmd;
import com.red.circle.other.inner.model.dto.game.GameKtvGiftConfigDTO;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * ktv礼物配置信息 前端控制器.
 *
 * @author zongpubin on 2023-05-05 18:06
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/game-ktv-gift-config")
public class GameKtvGiftConfigRestController extends BaseController {

  private final GameKtvGiftConfigService gameKtvGiftConfigService;

  /**
   * 获取KTV礼物信息.
   */
  @GetMapping
  public PageResult<GameKtvGiftConfigDTO> getSongGiftInfo(GameKtvGiftConfigQryCmd query) {
    return gameKtvGiftConfigService.getSongGiftInfo(query);
  }

  @OpsOperationReqLog(value = "新增KTV礼物信息")
  @PostMapping
  public void addSongGift(@RequestBody GameKtvGiftConfigDTO param) {
    param.setCreateUser(param.getReqUserId());
    gameKtvGiftConfigService.addSongGift(param);
  }

  @OpsOperationReqLog(value = "修改KTV礼物信息")
  @PutMapping
  public void updateSongGift(@RequestBody GameKtvGiftConfigDTO param) {
    param.setUpdateUser(param.getReqUserId());
    gameKtvGiftConfigService.updateSongGift(param);
  }

  /**
   * 删除KTV礼物.
   */
  @PutMapping("/delete/{id}")
  public void deleteSongGift(IdLongCmd cmd) {
    gameKtvGiftConfigService.deleteSongGift(cmd.getId(), cmd.getReqUserId());
  }

  /**
   * 列表查询.
   */
  @GetMapping("/list")
  public List<GameKtvGiftConfigDTO> listByCondition(GameKtvGiftConfigQryCmd query) {
    return gameKtvGiftConfigService.listByCondition(query);
  }


}
