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 (
	FileReadTool,
	EXASearchTool,
	SerperDevTool,
	ScrapeWebsiteTool
)






@CrewBase
class MADueDiligencePipelineCrew:
    """MADueDiligencePipeline crew"""

    
    @agent
    def pre_loi_investment_thesis_architect(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["pre_loi_investment_thesis_architect"],
            
            
            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 competitor_financial_benchmarker(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["competitor_financial_benchmarker"],
            
            
            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 corporate_culture_sentiment_auditor(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["corporate_culture_sentiment_auditor"],
            
            
            tools=[				SerperDevTool()],
            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 lead_digital_asset_traffic_scraper(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["lead_digital_asset_traffic_scraper"],
            
            
            tools=[				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",
                
                
            ),
            
        )
        
    

    
    @task
    def digital_infrastructure_audit(self) -> Task:
        return Task(
            config=self.tasks_config["digital_infrastructure_audit"],
            markdown=False,
            
            
        )
    
    @task
    def cultural_liability_assessment(self) -> Task:
        return Task(
            config=self.tasks_config["cultural_liability_assessment"],
            markdown=False,
            
            
        )
    
    @task
    def competitive_pricing_matrix(self) -> Task:
        return Task(
            config=self.tasks_config["competitive_pricing_matrix"],
            markdown=False,
            
            
        )
    
    @task
    def pre_loi_investment_thesis(self) -> Task:
        return Task(
            config=self.tasks_config["pre_loi_investment_thesis"],
            markdown=False,
            
            
        )
    

    @crew
    def crew(self) -> Crew:
        """Creates the MADueDiligencePipeline 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"),
        )


