package com.red.circle.other.app.inner.service.count.impl;

import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
import com.red.circle.other.app.inner.convertor.count.StatisticsPropsSaleQuotaInnerConvertor;
import com.red.circle.other.app.inner.service.count.StatisticsPropsSaleQuotaClientService;
import com.red.circle.other.infra.database.mongo.service.props.StatisticsPropsSaleQuotaService;
import com.red.circle.other.inner.model.cmd.count.PropsSaleQuotaQryCmd;
import com.red.circle.other.inner.model.dto.count.StatisticsPropsSaleQuotaDTO;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 道具销售情况.
 *
 * @author pengliang on 2023/11/17
 */
@Service
@RequiredArgsConstructor
public class StatisticsPropsSaleQuotaClientServiceImpl implements
    StatisticsPropsSaleQuotaClientService {

  private final StatisticsPropsSaleQuotaService statisticsPropsSaleQuotaService;
  private final StatisticsPropsSaleQuotaInnerConvertor statisticsPropsSaleQuotaInnerConvertor;

  @Override
  public List<StatisticsPropsSaleQuotaDTO> listPropsSaleQuota(PropsSaleQuotaQryCmd qryCmd) {
    return statisticsPropsSaleQuotaInnerConvertor.toListStatisticsPropsSaleQuotaDTO(
        statisticsPropsSaleQuotaService.listPropsSaleQuota(
            statisticsPropsSaleQuotaInnerConvertor.toPropsSaleQuotaQuery(qryCmd)
        )
    );
  }

  @Override
  public Long getYearPropsSaleQuota(SysOriginPlatformEnum sysOrigin, Long propsSourceId) {
    return statisticsPropsSaleQuotaService.getYearPropsSaleQuota(sysOrigin, propsSourceId);
  }

}
