# 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 MessageCreateRequestSenderType, PatchedTicketUpdateRequestStatus


class MessageCreateRequest(BaseModel):
    """
    Serializer for creating a message.

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

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

    text: str = Field(min_length=1)
    sender_type: MessageCreateRequestSenderType | None = Field(
    None,
    description="Who sent this message: 'customer...",
)



class TicketCreateRequest(BaseModel):
    """
    Serializer for creating a ticket.

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

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

    project_slug: str = Field(
    description='Slug of the project this ticket ...',
    min_length=1,
    pattern='^[-a-zA-Z0-9_]+$',
)
    subject: str = Field(min_length=1, max_length=255)
    first_message: str = Field(description='First message / description of t...', min_length=1)
    customer_id: str | None = Field(None, description='UUID of the customer (optional)')



class MessageList(BaseModel):
    """
    Serializer for listing messages.

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

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

    id: str = ...
    sender_type: MessageCreateRequestSenderType = Field(
    description='* `customer` - Customer * `admin...',
)
    is_from_customer: bool = ...
    is_from_admin: bool = ...
    text: Any = ...
    created_at: datetime.datetime = ...



class PaginatedMessageListList(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[MessageList] = Field(description='Array of items for current page')



class TicketList(BaseModel):
    """
    Serializer for listing tickets.

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

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

    id: str = ...
    subject: Any = ...
    status: PatchedTicketUpdateRequestStatus = Field(
    description='* `open` - Open * `waiting_for_u...',
)
    status_color: Any = ...
    message_count: int = ...
    project_slug: Any = Field(pattern='^[-a-zA-Z0-9_]+$')
    created_at: datetime.datetime = ...
    updated_at: datetime.datetime = ...



class PaginatedTicketListList(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[TicketList] = Field(description='Array of items for current page')



class PatchedTicketUpdateRequest(BaseModel):
    """
    Serializer for updating ticket status.

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

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

    status: PatchedTicketUpdateRequestStatus | None = Field(
    None,
    description='* `open` - Open * `waiting_for_u...',
)



class TicketDetail(BaseModel):
    """
    Serializer for ticket detail view.

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

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

    id: str = ...
    subject: Any = ...
    status: PatchedTicketUpdateRequestStatus = Field(
    description='* `open` - Open * `waiting_for_u...',
)
    status_color: Any = ...
    message_count: int = ...
    project_slug: Any = Field(pattern='^[-a-zA-Z0-9_]+$')
    created_at: datetime.datetime = ...
    updated_at: datetime.datetime = ...
    last_message_text: Any | None = None



