"""Color strip processing template schemas."""

from datetime import datetime
from typing import List, Optional

from pydantic import BaseModel, Field

from .filters import FilterInstanceSchema


class ColorStripProcessingTemplateCreate(BaseModel):
    """Request to create a color strip processing template."""

    name: str = Field(description="Template name", min_length=1, max_length=100)
    filters: List[FilterInstanceSchema] = Field(default_factory=list, description="Ordered list of filter instances")
    description: Optional[str] = Field(None, description="Template description", max_length=500)
    tags: List[str] = Field(default_factory=list, description="User-defined tags")


class ColorStripProcessingTemplateUpdate(BaseModel):
    """Request to update a color strip processing template."""

    name: Optional[str] = Field(None, description="Template name", min_length=1, max_length=100)
    filters: Optional[List[FilterInstanceSchema]] = Field(None, description="Ordered list of filter instances")
    description: Optional[str] = Field(None, description="Template description", max_length=500)
    tags: Optional[List[str]] = None


class ColorStripProcessingTemplateResponse(BaseModel):
    """Color strip processing template information response."""

    id: str = Field(description="Template ID")
    name: str = Field(description="Template name")
    filters: List[FilterInstanceSchema] = Field(description="Ordered list of filter instances")
    tags: List[str] = Field(default_factory=list, description="User-defined tags")
    created_at: datetime = Field(description="Creation timestamp")
    updated_at: datetime = Field(description="Last update timestamp")
    description: Optional[str] = Field(None, description="Template description")


class ColorStripProcessingTemplateListResponse(BaseModel):
    """List of color strip processing templates response."""

    templates: List[ColorStripProcessingTemplateResponse] = Field(description="List of templates")
    count: int = Field(description="Number of templates")
