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

import com.red.circle.framework.core.asserts.ResponseAssert;
import com.red.circle.framework.dto.PageResult;
import com.red.circle.other.inner.endpoint.material.props.PropsActivityRewardGroupClient;
import com.red.circle.other.inner.model.cmd.material.PropsActivityRewardGroupParamCmd;
import com.red.circle.other.inner.model.cmd.material.PropsActivityRewardGroupQryCmd;
import com.red.circle.other.inner.model.dto.material.ActivityGroupKeyValueDTO;
import com.red.circle.other.inner.model.dto.material.PropsActivityRewardGroupDTO;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 道具活动配置分组
 *
 * @author zongpubin on 2023/10/23
 */
@Service
@RequiredArgsConstructor
public class PropsActivityRewardGroupServiceImpl implements PropsActivityRewardGroupService {

  private final PropsActivityRewardGroupClient propsActivityRewardGroupClient;

  @Override
  public PageResult<PropsActivityRewardGroupDTO> pagePropsActivityRewardGroup(PropsActivityRewardGroupQryCmd query) {

    return ResponseAssert.requiredSuccess(propsActivityRewardGroupClient.pagePropsActivityRewardGroup(query));
  }

  @Override
  public PropsActivityRewardGroupDTO getByGroupId(Long id) {
    return ResponseAssert.requiredSuccess(propsActivityRewardGroupClient.getByGroupId(id));
  }

  @Override
  public String saveOrUpdate(PropsActivityRewardGroupParamCmd propsActivityRewardGroupParam) {

    return ResponseAssert.requiredSuccess(
        propsActivityRewardGroupClient.saveOrUpdate(propsActivityRewardGroupParam));
  }

  @Override
  public void offShelf(Long id, Boolean offShelf) {
    ResponseAssert.requiredSuccess(propsActivityRewardGroupClient.offShelf(id, offShelf));
  }

  @Override
  public List<ActivityGroupKeyValueDTO> getActivityGroupKeyValueList() {
    return ResponseAssert.requiredSuccess(
        propsActivityRewardGroupClient.getActivityGroupKeyValueList());
  }
}
