"""
Task Related Requests - Complete Strands Implementation
Converts all Kore AI workflows to Strands agents
"""

from strands import Agent, tool
from typing import Dict, Any
import asyncio
from datetime import datetime

# ============================================================================
# SHARED TOOLS (Used across multiple agents)
# ============================================================================

@tool
async def create_task(task_data: Dict[str, Any]):
    """Creates a task for agent handling"""
    
    try:
        yield "Creating task..."
        await asyncio.sleep(0.2)
        
        yield "Generating task ID..."
        task_id = f"TASK-{datetime.now().strftime('%Y%m%d%H%M%S')}"
        await asyncio.sleep(0.2)
        
        yield f"Task {task_id} created successfully!"
        yield f"Your request has been received, and a task {task_id} has been created for an NFS agent to handle. Please monitor status from your dashboard."
        
    except Exception as e:
        yield f"Error creating task: {str(e)}"


# Global workflow state storage
workflow_states: Dict[str, Dict[str, Any]] = {}

# Task Creation Agent - Task Creation Only
task_create_agent = Agent(
    name="TaskCreationAgent",
    system_prompt="""You handle task creation requests by creating a task for agent handling.

When a user requests a task creation:
1. Acknowledge their request
2. Call create_task tool with their request details
3. Provide the task confirmation to the user

Be helpful and concise.""",
    model="amazon.nova-lite-v1:0",
    tools=[create_task]
)


# Export all agents
__all__ = [
    "task_create_agent",
]