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,
	OCRTool
)
from multi_cam_podcast_post_production_engine.tools.video_upload_tool import VideoUploadTool





@CrewBase
class MultiCamPodcastPostProductionEngineCrew:
    """MultiCamPodcastPostProductionEngine crew"""

    
    @agent
    def multi_cam_dialogue_director(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["multi_cam_dialogue_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",
                
                
            ),
            
        )
        
    
    @agent
    def lead_post_production_editor(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["lead_post_production_editor"],
            
            
            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 video_quality_control_specialist(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["video_quality_control_specialist"],
            
            
            tools=[				OCRTool()],
            
            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 social_media_automation_manager(self) -> Agent:
        
        
        return Agent(
            config=self.agents_config["social_media_automation_manager"],
            
            
            tools=[				VideoUploadTool()],
            
            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 generate_camera_switching_timeline(self) -> Task:
        return Task(
            config=self.tasks_config["generate_camera_switching_timeline"],
            markdown=False,
            
            
        )
    
    @task
    def build_rendering_manifest(self) -> Task:
        return Task(
            config=self.tasks_config["build_rendering_manifest"],
            markdown=False,
            
            
        )
    
    @task
    def quality_control_video_frames(self) -> Task:
        return Task(
            config=self.tasks_config["quality_control_video_frames"],
            markdown=False,
            
            
        )
    
    @task
    def publish_to_social_media(self) -> Task:
        return Task(
            config=self.tasks_config["publish_to_social_media"],
            markdown=False,
            
            
        )
    

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


