package com.ruoyi.bst.team.service.impl;

import com.ruoyi.bst.team.domain.TeamQuery;
import com.ruoyi.bst.team.domain.TeamVO;
import com.ruoyi.bst.team.domain.enums.TeamStatus;
import com.ruoyi.bst.team.service.TeamService;
import com.ruoyi.bst.team.service.TeamValidator;
import com.ruoyi.bst.teamUser.domain.TeamUserQuery;
import com.ruoyi.bst.teamUser.domain.TeamUserVO;
import com.ruoyi.bst.teamUser.domain.enums.UserStatus;
import com.ruoyi.bst.teamUser.service.TeamUserService;
import com.ruoyi.bst.teamUser.service.TeamUserValidator;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TeamValidatorImpl implements TeamValidator {

    @Autowired
    private TeamService teamService;

    @Override
    public boolean canAddUser(Long teamId) {
        TeamQuery query = new TeamQuery();
        query.setId(teamId);
        query.setStatus(TeamStatus.NORMAL.getCode());
        TeamVO vo = teamService.selectOne(query);
        return vo != null;
    }
}
