from wandagents.gov.govern import Govern
from wandagents.economy.system import System
from .member import TeamMember

class Team:
    govern: Govern
    system: System
    members: TeamMember
    
    def __init__(self, system: System, llm_config):
        self.govern = Govern(llm_config)
        self.system = system
        self.llm_config = llm_config
        self.members = []
        
    def get_team_names(self):
        return [ member.name for member in self.members ]
    
    def get_gov_names(self):
        return [ member.name for member in self.get_govern_members() ]
    
    def get_all_names(self):
        return self.get_team_names() + self.get_gov_names()
    
    def add_member(self, member: TeamMember):
        self.members.append(member)
    
    def get_govern_members(self):
        return self.govern.get_members()
    
    def get_members(self, names: list[str] = None) -> list[TeamMember]:
        govern = self.get_govern_members()
        members = govern + self.members
        if names is not None:
            return [ member for member in members if member.name in names ]
        return govern