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

import com.red.circle.framework.dto.ResultResponse;
import com.red.circle.other.app.inner.service.sys.SysGiftPackConfigClientService;
import com.red.circle.other.inner.endpoint.sys.api.SysGiftPackConfigClientApi;
import com.red.circle.other.inner.model.cmd.sys.GiftPackConfigQryCmd;
import com.red.circle.other.inner.model.cmd.sys.SysGiftPackParamCmd;
import com.red.circle.other.inner.model.dto.sys.SysGiftPackConfigDTO;
import com.red.circle.other.inner.model.dto.sys.SysGiftPackParamDTO;
import java.math.BigDecimal;
import java.util.List;
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 zongpubin on 2023/10/31
 */
@Validated
@RestController
@RequestMapping(value = SysGiftPackConfigClientApi.API_PREFIX, produces = MediaType.APPLICATION_JSON_VALUE)
@RequiredArgsConstructor
public class SysGiftPackConfigClientEndpoint implements SysGiftPackConfigClientApi {

  private final SysGiftPackConfigClientService giftPackConfigClientService;

  @Override
  public ResultResponse<Void> giftPackConfig(SysGiftPackParamCmd sysGiftPackParam) {
    giftPackConfigClientService.giftPackConfig(sysGiftPackParam);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<Void> addGiftPackConfig(SysGiftPackParamCmd sysGiftPackParam) {
    giftPackConfigClientService.addGiftPackConfig(sysGiftPackParam);
    return ResultResponse.success();
  }

  @Override
  public ResultResponse<SysGiftPackParamDTO> getGiftPackConfig(Long giftPackId) {
    return ResultResponse.success(giftPackConfigClientService.getGiftPackConfig(giftPackId));
  }

  @Override
  public ResultResponse<BigDecimal> getGoldByPackId(Long giftPackId) {
    return ResultResponse.success(giftPackConfigClientService.getGoldByPackId(giftPackId));
  }

  @Override
  public ResultResponse<List<SysGiftPackConfigDTO>> getGiftPackConfigInfo(
      GiftPackConfigQryCmd query) {
    return ResultResponse.success(giftPackConfigClientService.getGiftPackConfigInfo(query));
  }
}
