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






@CrewBase
class RealEstateDealUnderwriterCrew:
    """RealEstateDealUnderwriter crew"""

    
    @agent
    def lead_gis_public_records_data_scraper(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["lead_gis_public_records_data_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",
                
                
            ),
            
        )
        
    
    @agent
    def market_comp_cap_rate_benchmarker(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["market_comp_cap_rate_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 distress_indicator_deal_filter(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["distress_indicator_deal_filter"],
            
            
            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 direct_offer_outreach_architect(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["direct_offer_outreach_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",
                
                
            ),
            
        )
        
    

    
    @task
    def regional_property_reconnaissance(self) -> Task:
        return Task(
            config=self.tasks_config["regional_property_reconnaissance"],
            markdown=False,
            
            
        )
    
    @task
    def financial_benchmarking_underwriting(self) -> Task:
        return Task(
            config=self.tasks_config["financial_benchmarking_underwriting"],
            markdown=False,
            
            
        )
    
    @task
    def high_probability_target_filtering(self) -> Task:
        return Task(
            config=self.tasks_config["high_probability_target_filtering"],
            markdown=False,
            
            
        )
    
    @task
    def acquisition_outreach_campaign(self) -> Task:
        return Task(
            config=self.tasks_config["acquisition_outreach_campaign"],
            markdown=False,
            
            
        )
    

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


