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

import com.red.circle.other.app.inner.convertor.team.TeamApplicationProcessConvertor;
import com.red.circle.other.app.inner.service.team.TeamApplicationProcessClientService;
import com.red.circle.other.infra.database.mongo.entity.team.team.TeamApplicationProcess;
import com.red.circle.other.infra.database.mongo.service.team.team.TeamApplicationProcessService;
import com.red.circle.other.inner.model.dto.team.TeamApplicationProcessDTO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Set;


/**
 * bd 团队成员
 *
 * @author longli on 2024/03/12
 */
@Service
@RequiredArgsConstructor
public class TeamApplicationProcessClientServiceImpl implements TeamApplicationProcessClientService {

    private final TeamApplicationProcessService teamApplicationProcessService;
    private final TeamApplicationProcessConvertor teamApplicationProcessConvertor;
    @Override
    public List<TeamApplicationProcessDTO> getListByIds(Set<Long> ids) {
        List<TeamApplicationProcess> teamApplicationProcessList = teamApplicationProcessService.listByIds(ids);
        List<TeamApplicationProcessDTO> teamApplicationProcessDTOList = teamApplicationProcessConvertor.toListDTo(teamApplicationProcessList);
        return teamApplicationProcessDTOList;
    }

    @Override
    public List<TeamApplicationProcessDTO> listLastMonthApplyOutTeamMember() {
        List<TeamApplicationProcess> teamApplicationProcessList = teamApplicationProcessService.listLastMonthApplyOutTeamMember();
        List<TeamApplicationProcessDTO> teamApplicationProcessDTOList = teamApplicationProcessConvertor.toListDTo(teamApplicationProcessList);
        return teamApplicationProcessDTOList;
    }

    @Override
    public List<TeamApplicationProcessDTO> listApplyOutTeamMember(Integer day) {
        List<TeamApplicationProcess> teamApplicationProcessList = teamApplicationProcessService.listApplyOutTeamMember(day);
        List<TeamApplicationProcessDTO> teamApplicationProcessDTOList = teamApplicationProcessConvertor.toListDTo(teamApplicationProcessList);
        return teamApplicationProcessDTOList;
    }

    @Override
    public TeamApplicationProcessDTO getQuitWaitApplyById(Long id) {
        TeamApplicationProcess teamApplicationProcess = teamApplicationProcessService.getQuitWaitApplyById(id);
        if (teamApplicationProcess != null) {
            TeamApplicationProcessDTO teamApplicationProcessDTO = teamApplicationProcessConvertor.toDTO(teamApplicationProcess);
            return teamApplicationProcessDTO;
        }
        return null;
    }

    @Override
    public void deleteById(Long id) {
        teamApplicationProcessService.deleteById(id);
    }
}
