param(
    [Parameter(Mandatory=$true, Position=0)]
    [ValidateSet("tier1", "tier2", "tier3", "tier4", "orchestrator", "tech-lead", "worker", "qa")]
    [string]$Role,

    [Parameter(Mandatory=$true, Position=1)]
    [string]$Prompt
)

# Map human-readable aliases to mma_exec roles
$RoleMap = @{
    "orchestrator" = "tier1-orchestrator"
    "tier1"        = "tier1-orchestrator"
    "tech-lead"    = "tier2-tech-lead"
    "tier2"        = "tier2-tech-lead"
    "worker"       = "tier3-worker"
    "tier3"        = "tier3-worker"
    "qa"           = "tier4-qa"
    "tier4"        = "tier4-qa"
}

$MappedRole = $RoleMap[$Role.ToLower()]

Write-Host "[MMA] Spawning Role: $MappedRole" -ForegroundColor Cyan
uv run python scripts/mma_exec.py --role $MappedRole $Prompt
