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

import com.red.circle.framework.dto.PageResult;
import com.red.circle.other.app.inner.convertor.activity.AgentActivityCountInnerConvert;
import com.red.circle.other.app.inner.service.activity.AgentActivityCountClientService;
import com.red.circle.other.infra.database.mongo.service.activity.ActivityAgentAnchorCountService;
import com.red.circle.other.infra.database.mongo.service.activity.AgentActivityCountService;
import com.red.circle.other.inner.enums.activity.AgentActivityCountType;
import com.red.circle.other.inner.model.dto.activity.AgentActivityCountDTO;
import java.util.Collection;
import java.util.Set;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 代理活动相关实现
 *
 * @author zongpubin on 2023/8/15
 */
@Service
@RequiredArgsConstructor
public class AgentActivityCountClientServiceImpl implements AgentActivityCountClientService {

  private final AgentActivityCountService agentActivityCountService;
  private final AgentActivityCountInnerConvert agentActivityCountInnerConvert;
  private final ActivityAgentAnchorCountService activityAgentAnchorCountService;

  @Override
  public void incrTarget(Long teamId, Long target, String regionId) {
    agentActivityCountService.incrTarget(teamId, target, regionId);
  }

  @Override
  public void reduceTarget(Collection<Long> teamIds, Long target) {
    agentActivityCountService.reduceTarget(teamIds, target);
  }

  @Override
  public void removeByTeamIds(Collection<Long> teamIds) {
    agentActivityCountService.removeByTeamIds(teamIds);
  }

  @Override
  public void initZero(Long acceptUserId, Long teamId) {
    activityAgentAnchorCountService.initZero(acceptUserId, teamId);
  }

  @Override
  public PageResult<AgentActivityCountDTO> pageData(AgentActivityCountType countType,
      String regionId, Integer current, Integer limitSize) {
    return agentActivityCountInnerConvert.toPageAgentActivityCountDTO(
        agentActivityCountService.pageData(countType, regionId, current, limitSize)
    );
  }


  @Override
  public void initZeroTeam(Long teamId) {
    activityAgentAnchorCountService.initZeroTeam(teamId);
  }


  @Override
  public void initZeroMember(Set<Long> acceptUserIds) {
    activityAgentAnchorCountService.initZeroMember(acceptUserIds);
  }
}
