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

import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
import com.red.circle.console.app.service.app.sys.SysLotteryConfService;
import com.red.circle.framework.web.controller.BaseController;
import com.red.circle.other.inner.model.cmd.activity.lottery.ActivityLotteryTurntableCache;
import com.red.circle.other.inner.model.cmd.sys.AddLotteryTurntableCmd;
import lombok.RequiredArgsConstructor;
import org.springframework.http.MediaType;
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.RestController;

/**
 * 抽奖配置.
 *
 * @author pengliang on 2021/11/22
 */
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/lottery/conf", produces = MediaType.APPLICATION_JSON_VALUE)
public class SysLotteryConfRestController extends BaseController {

  private final SysLotteryConfService sysLotteryConfService;

  /**
   * 获取指定平台配置信息.
   */
  @GetMapping
  public ActivityLotteryTurntableCache getLotteryConf(
      SysOriginPlatformEnum sysOrigin) {
    return sysLotteryConfService.getLotteryTurntable(sysOrigin);
  }

  /**
   * 设置参数.
   */
  @PostMapping
  public void addLotteryConf(@RequestBody AddLotteryTurntableCmd param) {
    sysLotteryConfService.addLotteryTurntable(param);
  }

}
