import os

from crewai import LLM
from crewai import Agent, Crew, Process, Task
from crewai.project import CrewBase, agent, crew, task
from crewai_tools import (
	EXASearchTool,
	ScrapeWebsiteTool,
	FileReadTool,
	JinaScrapeWebsiteTool
)






@CrewBase
class EntrepreneurSnifferMAAutomationFactoryCrew:
    """EntrepreneurSnifferMAAutomationFactory crew"""

    
    @agent
    def m_a_target_assessment_specialist(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["m_a_target_assessment_specialist"],
            
            
            tools=[				EXASearchTool(),
				ScrapeWebsiteTool()],
            reasoning=False,
            max_reasoning_attempts=None,
            inject_date=True,
            allow_delegation=False,
            max_iter=25,
            max_rpm=None,
            
            
            max_execution_time=None,
            llm=LLM(
                model="openai/gpt-4o-mini",
                
                
            ),
            
        )
        
    
    @agent
    def m_a_deal_structure_documentation_specialist(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["m_a_deal_structure_documentation_specialist"],
            
            
            tools=[				FileReadTool()],
            reasoning=False,
            max_reasoning_attempts=None,
            inject_date=True,
            allow_delegation=False,
            max_iter=25,
            max_rpm=None,
            
            
            max_execution_time=None,
            llm=LLM(
                model="openai/gpt-4o-mini",
                
                
            ),
            
        )
        
    
    @agent
    def strategic_m_a_outreach_specialist(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["strategic_m_a_outreach_specialist"],
            
            
            tools=[				EXASearchTool()],
            reasoning=False,
            max_reasoning_attempts=None,
            inject_date=True,
            allow_delegation=False,
            max_iter=25,
            max_rpm=None,
            
            
            max_execution_time=None,
            llm=LLM(
                model="openai/gpt-4o-mini",
                
                
            ),
            
        )
        
    
    @agent
    def web_search_link_validation_specialist(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["web_search_link_validation_specialist"],
            
            
            tools=[				EXASearchTool(),
				ScrapeWebsiteTool(),
				JinaScrapeWebsiteTool()],
            reasoning=False,
            max_reasoning_attempts=None,
            inject_date=True,
            allow_delegation=False,
            max_iter=25,
            max_rpm=None,
            
            
            max_execution_time=None,
            llm=LLM(
                model="openai/gpt-4o-mini",
                
                
            ),
            
        )
        
    

    
    @task
    def search_and_validate_m_a_targets(self) -> Task:
        return Task(
            config=self.tasks_config["search_and_validate_m_a_targets"],
            markdown=False,
            
            
        )
    
    @task
    def assess_and_rank_validated_targets(self) -> Task:
        return Task(
            config=self.tasks_config["assess_and_rank_validated_targets"],
            markdown=False,
            
            
        )
    
    @task
    def generate_deal_structure_and_loi(self) -> Task:
        return Task(
            config=self.tasks_config["generate_deal_structure_and_loi"],
            markdown=False,
            
            
        )
    
    @task
    def create_personalized_outreach_campaign(self) -> Task:
        return Task(
            config=self.tasks_config["create_personalized_outreach_campaign"],
            markdown=False,
            
            
        )
    

    @crew
    def crew(self) -> Crew:
        """Creates the EntrepreneurSnifferMAAutomationFactory crew"""

        return Crew(
            agents=self.agents,  # Automatically created by the @agent decorator
            tasks=self.tasks,  # Automatically created by the @task decorator
            process=Process.sequential,
            verbose=True,

            chat_llm=LLM(model="openai/gpt-4o-mini"),
        )


