# Auto-generated by DjangoCFG - see CLAUDE.md

from __future__ import annotations
import datetime
from typing import Any

from pydantic import BaseModel, ConfigDict, Field

from ..enums import (
    OGImageGenerateRequestMethod,
    OGImageGenerateRequestSize,
    OGImageGenerateRequestStyle,
    OGImageManagedResponseMethod,
    OGImageManagedResponseStatus,
    OGImagePresetStyle,
)


class OGImageGenerateRequest(BaseModel):
    """
    Input for POST /api/ogimage/generate/ and /generate-async/

    Request model (no read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    title: str = Field(min_length=1, max_length=300)
    description: str | None = Field(None, max_length=600)
    locale: str | None = Field(None, min_length=1, max_length=10)
    page_url: str | None = Field(None, max_length=2048)
    method: OGImageGenerateRequestMethod | None = Field(
    None,
    description='* `direct` - direct * `llm` - llm',
)
    preset_slug: str | None = Field(None, min_length=1, pattern='^[-a-zA-Z0-9_]+$')
    bg_color: str | None = Field(None, min_length=1, pattern='^#[0-9a-fA-F]{6}$')
    bg_color2: str | None = Field(None, min_length=1, pattern='^#[0-9a-fA-F]{6}$')
    text_color: str | None = Field(None, min_length=1, pattern='^#[0-9a-fA-F]{6}$')
    accent_color: str | None = Field(None, min_length=1, pattern='^#[0-9a-fA-F]{6}$')
    style: OGImageGenerateRequestStyle | None = Field(
    None,
    description='* `dark` - dark * `light` - light',
)
    llm_model: str | None = Field(None, min_length=1, max_length=100)
    image_model: str | None = Field(None, min_length=1, max_length=100)
    style_hint: str | None = Field(None, min_length=1, max_length=80)
    size: OGImageGenerateRequestSize | None = Field(
    None,
    description='* `1200x630` - 1200x630 * `1200x...',
)



class OGImagePublicUrl(BaseModel):
    """
    Response for the public-url action — returns render URL and CDN URL.

    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    public_url: Any = ...
    cdn_url: Any = ...



class OGImageManagedResponse(BaseModel):
    """
    Output for all managed OGImage responses.

    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    id: str = ...
    slug: Any | None = Field(
    None,
    description='Stable identifier for managed LL...',
    pattern='^[-a-zA-Z0-9_]+$',
)
    title: Any = ...
    description: Any = ...
    locale: Any = ...
    method: OGImageManagedResponseMethod = Field(description='* `direct` - Direct (PicTex canv...')
    status: OGImageManagedResponseStatus = Field(description='* `pending` - Pending * `queued`...')
    stable_url: Any = ...
    cdn_url: Any | None = None
    cost_usd: Any = Field(pattern='^-?\\d{0,4}(?:\\.\\d{0,6})?$')
    duration_ms: int = ...
    job_id: Any = Field(description='django-rq job ID for async gener...')
    llm_prompt: Any = Field(description='Final prompt sent to image gener...')
    error_message: Any = ...
    created_at: datetime.datetime = ...
    updated_at: datetime.datetime = ...



class PaginatedOGImageManagedResponseList(BaseModel):
    """
    
    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    count: int = Field(description='Total number of items across all...')
    page: int = Field(description='Current page number (1-based)')
    pages: int = Field(description='Total number of pages')
    page_size: int = Field(description='Number of items per page')
    has_next: bool = Field(description='Whether there is a next page')
    has_previous: bool = Field(description='Whether there is a previous page')
    next_page: int | None = Field(None, description='Next page number (null if no nex...')
    previous_page: int | None = Field(None, description='Previous page number (null if no...')
    results: list[OGImageManagedResponse] = Field(description='Array of items for current page')



class OGImagePreset(BaseModel):
    """
    
    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    id: str = ...
    slug: str = Field(
    description='URL-safe identifier used in OGIm...',
    max_length=80,
    pattern='^[-a-zA-Z0-9_]+$',
)
    name: str = Field(max_length=100)
    description: str | None = None
    method: OGImageManagedResponseMethod | None = Field(
    None,
    description='* `direct` - Direct (PicTex canv...',
)
    llm_model: str | None = Field(None, max_length=100)
    image_model: str | None = Field(None, max_length=100)
    style_hint: str | None = Field(None, max_length=80)
    style: OGImagePresetStyle | None = Field(
    None,
    description='* `dark` - Dark gradient * `ligh...',
)
    bg_color: str | None = Field(None, max_length=7)
    bg_color2: str | None = Field(None, max_length=7)
    text_color: str | None = Field(None, max_length=7)
    accent_color: str | None = Field(None, max_length=7)
    default_locale: str | None = Field(None, max_length=10)
    is_default: bool | None = Field(None, description='Used when no preset_slug provide...')
    is_active: bool | None = None
    created_at: datetime.datetime = ...
    updated_at: datetime.datetime = ...



class PaginatedOGImagePresetList(BaseModel):
    """
    
    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    count: int = Field(description='Total number of items across all...')
    page: int = Field(description='Current page number (1-based)')
    pages: int = Field(description='Total number of pages')
    page_size: int = Field(description='Number of items per page')
    has_next: bool = Field(description='Whether there is a next page')
    has_previous: bool = Field(description='Whether there is a previous page')
    next_page: int | None = Field(None, description='Next page number (null if no nex...')
    previous_page: int | None = Field(None, description='Previous page number (null if no...')
    results: list[OGImagePreset] = Field(description='Array of items for current page')



class PatchedOGImagePresetRequest(BaseModel):
    """
    
    Request model (no read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    slug: str | None = Field(
    None,
    description='URL-safe identifier used in OGIm...',
    min_length=1,
    max_length=80,
    pattern='^[-a-zA-Z0-9_]+$',
)
    name: str | None = Field(None, min_length=1, max_length=100)
    description: str | None = None
    method: OGImageManagedResponseMethod | None = Field(
    None,
    description='* `direct` - Direct (PicTex canv...',
)
    llm_model: str | None = Field(None, min_length=1, max_length=100)
    image_model: str | None = Field(None, min_length=1, max_length=100)
    style_hint: str | None = Field(None, min_length=1, max_length=80)
    style: OGImagePresetStyle | None = Field(
    None,
    description='* `dark` - Dark gradient * `ligh...',
)
    bg_color: str | None = Field(None, min_length=1, max_length=7)
    bg_color2: str | None = Field(None, min_length=1, max_length=7)
    text_color: str | None = Field(None, min_length=1, max_length=7)
    accent_color: str | None = Field(None, min_length=1, max_length=7)
    default_locale: str | None = Field(None, min_length=1, max_length=10)
    is_default: bool | None = Field(None, description='Used when no preset_slug provide...')
    is_active: bool | None = None



class OGImageResponse(BaseModel):
    """
    
    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    id: str = ...
    cache_key: str = Field(description='SHA256[:40] of normalized OGImag...', max_length=40)
    method: OGImageManagedResponseMethod | None = Field(
    None,
    description='* `direct` - Direct (PicTex canv...',
)
    locale: str | None = Field(None, max_length=10)
    title: str = Field(max_length=300)
    cdn_url: Any = ...
    image_url: str | None = Field(
    None,
    description='CDN URL of the generated image',
    max_length=2048,
)
    status: OGImageManagedResponseStatus | None = Field(
    None,
    description='* `pending` - Pending * `queued`...',
)
    cost_usd: Any | None = Field(None, pattern='^-?\\d{0,4}(?:\\.\\d{0,6})?$')
    duration_ms: int | None = Field(None, ge=-2147483648, le=2147483647)
    created_at: datetime.datetime = ...



class PaginatedOGImageResponseList(BaseModel):
    """
    
    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    count: int = Field(description='Total number of items across all...')
    page: int = Field(description='Current page number (1-based)')
    pages: int = Field(description='Total number of pages')
    page_size: int = Field(description='Number of items per page')
    has_next: bool = Field(description='Whether there is a next page')
    has_previous: bool = Field(description='Whether there is a previous page')
    next_page: int | None = Field(None, description='Next page number (null if no nex...')
    previous_page: int | None = Field(None, description='Previous page number (null if no...')
    results: list[OGImageResponse] = Field(description='Array of items for current page')



class OGImageAsyncResponse(BaseModel):
    """
    
    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    id: int = ...
    job_id: str = ...
    status: str = ...
    cache_key: str = ...



class OGImagePresetRequest(BaseModel):
    """
    
    Request model (no read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    slug: str = Field(
    description='URL-safe identifier used in OGIm...',
    min_length=1,
    max_length=80,
    pattern='^[-a-zA-Z0-9_]+$',
)
    name: str = Field(min_length=1, max_length=100)
    description: str | None = None
    method: OGImageManagedResponseMethod | None = Field(
    None,
    description='* `direct` - Direct (PicTex canv...',
)
    llm_model: str | None = Field(None, min_length=1, max_length=100)
    image_model: str | None = Field(None, min_length=1, max_length=100)
    style_hint: str | None = Field(None, min_length=1, max_length=80)
    style: OGImagePresetStyle | None = Field(
    None,
    description='* `dark` - Dark gradient * `ligh...',
)
    bg_color: str | None = Field(None, min_length=1, max_length=7)
    bg_color2: str | None = Field(None, min_length=1, max_length=7)
    text_color: str | None = Field(None, min_length=1, max_length=7)
    accent_color: str | None = Field(None, min_length=1, max_length=7)
    default_locale: str | None = Field(None, min_length=1, max_length=10)
    is_default: bool | None = Field(None, description='Used when no preset_slug provide...')
    is_active: bool | None = None



class OGImageStatus(BaseModel):
    """
    
    Response model (includes read-only fields).
    """

    model_config = ConfigDict(
        validate_assignment=True,
        extra="allow",
        frozen=False,
    )

    id: str = ...
    status: OGImageManagedResponseStatus | None = Field(
    None,
    description='* `pending` - Pending * `queued`...',
)
    cdn_url: Any = ...
    cost_usd: Any | None = Field(None, pattern='^-?\\d{0,4}(?:\\.\\d{0,6})?$')
    duration_ms: int | None = Field(None, ge=-2147483648, le=2147483647)
    error_message: str | None = None
    created_at: datetime.datetime = ...



