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






@CrewBase
class CrisisPrSentimentShieldCrew:
    """CrisisPrSentimentShield crew"""

    
    @agent
    def lead_digital_sentiment_monitor(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["lead_digital_sentiment_monitor"],
            
            
            tools=[				EXASearchTool(),
				ScrapeWebsiteTool(),
				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 crisis_risk_threat_assessor(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["crisis_risk_threat_assessor"],
            
            
            tools=[				EXASearchTool(),
				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 historical_pr_precedent_archivist(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["historical_pr_precedent_archivist"],
            
            
            tools=[				EXASearchTool(),
				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 chief_crisis_communications_director(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["chief_crisis_communications_director"],
            
            
            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 digital_sentiment_anomaly_detection(self) -> Task:
        return Task(
            config=self.tasks_config["digital_sentiment_anomaly_detection"],
            markdown=False,
            
            
        )
    
    @task
    def crisis_threat_level_assessment(self) -> Task:
        return Task(
            config=self.tasks_config["crisis_threat_level_assessment"],
            markdown=False,
            
            
        )
    
    @task
    def strategic_precedent_analysis(self) -> Task:
        return Task(
            config=self.tasks_config["strategic_precedent_analysis"],
            markdown=False,
            
            
        )
    
    @task
    def crisis_response_matrix_development(self) -> Task:
        return Task(
            config=self.tasks_config["crisis_response_matrix_development"],
            markdown=False,
            
            
        )
    

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


