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

import com.red.circle.console.app.service.app.props.RedPacketSkinService;
import com.red.circle.console.infra.annotations.OpsOperationReqLog;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.inner.model.cmd.material.PropsRedPacketSkinCmd;
import com.red.circle.other.inner.model.dto.material.PropsRedPacketSkinDTO;
import lombok.RequiredArgsConstructor;
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 pengshigang on 2023-11-08 09:40
 */
@RequiredArgsConstructor
@RestController
@RequestMapping("/props/red-packet/skin")
public class PropsRedPacketSkinRestController extends BaseController {

  private final RedPacketSkinService redPacketSkinService;

  /**
   * 根据ID获得资源信息.
   */
  @GetMapping("/{id}")
  public PropsRedPacketSkinDTO getRedPacketSkinById(@PathVariable("id") Long id) {
    return redPacketSkinService.getPropsRedPacketSkin(id);
  }

  @OpsOperationReqLog(value = "编辑-道具红包皮肤具体图片")
  @PostMapping("/save")
  public void saveRedPacketSkin(@RequestBody @Validated PropsRedPacketSkinCmd skinParam) {
    redPacketSkinService.saveRedPacketSkin(skinParam);
  }

}
