"""Pydantic models for loop directive endpoints."""

from __future__ import annotations

from datetime import datetime
from enum import Enum
from typing import Any
from uuid import UUID

from pydantic import BaseModel, Field


class DirectiveType(str, Enum):
    pause = "pause"
    resume = "resume"
    stop = "stop"
    redirect = "redirect"
    answer = "answer"


class DirectiveStatus(str, Enum):
    pending = "pending"
    acknowledged = "acknowledged"
    completed = "completed"


class DirectiveCreate(BaseModel):
    directive_type: DirectiveType
    payload: dict[str, Any] = Field(default_factory=dict)
    created_by: str


class DirectiveUpdate(BaseModel):
    status: DirectiveStatus


class DirectiveResponse(BaseModel):
    id: UUID
    loop_id: str
    directive_type: DirectiveType
    payload: dict[str, Any]
    status: DirectiveStatus
    created_by: str
    created_at: datetime
    acknowledged_at: datetime | None = None
