# 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 CampaignDetailStatus, EmailLogStatus


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

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

    newsletter: str = ...
    subject: str = Field(min_length=1, max_length=255)
    email_title: str = Field(min_length=1, max_length=255)
    main_text: str = Field(min_length=1)
    main_html_content: str | None = None
    button_text: str | None = Field(None, max_length=100)
    button_url: str | None = Field(None, max_length=200)
    secondary_text: str | None = None



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

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

    subscription_id: str = Field(description='ID of the subscription to cancel')



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

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

    id: str = ...
    newsletter: str = ...
    newsletter_title: Any = ...
    email: str = ...
    is_active: bool = ...
    subscribed_at: datetime.datetime = ...
    unsubscribed_at: datetime.datetime | None = None



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

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

    success: bool = ...
    subscription_id: str | None = None
    already_subscribed: bool | None = None
    error: str | None = None



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



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

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

    success: bool = ...
    campaign_id: str | None = None
    recipient_count: int | None = None
    status: str | None = None
    error: str | None = None



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

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

    newsletter_id: str = Field(description='ID of the newsletter to subscrib...')
    email: str = Field(description='Email address to subscribe', min_length=1)



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

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

    id: str = ...
    title: Any = ...
    description: Any = ...
    is_active: bool = ...
    auto_subscribe: bool = Field(description='Auto-subscribe new customers to ...')
    subscribers_count: int = ...
    project_slug: Any | None = Field(None, pattern='^[-a-zA-Z0-9_]+$')
    created_at: datetime.datetime = ...
    updated_at: datetime.datetime = ...



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

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

    id: str = ...
    recipient: Any = Field(description='Recipient email address(es)')
    subject: Any = ...
    status: EmailLogStatus = Field(description='* `pending` - Pending * `sent` -...')
    is_opened: bool = ...
    is_clicked: bool = ...
    created_at: datetime.datetime = ...
    sent_at: datetime.datetime | None = None
    opened_at: datetime.datetime | None = None
    clicked_at: datetime.datetime | None = None
    error_message: Any = ...



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



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

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

    title: str | None = Field(None, min_length=1, max_length=255)
    description: str | None = None
    is_active: bool | None = None
    auto_subscribe: bool | None = Field(None, description='Auto-subscribe new customers to ...')



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

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

    id: str = ...
    newsletter: str = ...
    newsletter_title: Any = ...
    subject: Any = ...
    status: CampaignDetailStatus = Field(description='* `draft` - Draft * `sending` - ...')
    status_color: Any = ...
    recipient_count: int = ...
    created_at: datetime.datetime = ...
    sent_at: datetime.datetime | None = None



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



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

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

    title: str = Field(min_length=1, max_length=255)
    description: str | None = None
    is_active: bool | None = None
    auto_subscribe: bool | None = Field(None, description='Auto-subscribe new customers to ...')
    project_slug: str | None = Field(
    None,
    description='Slug of the project to associate...',
    pattern='^[-a-zA-Z0-9_]+$',
)



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

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

    id: str = ...
    newsletter: str = ...
    newsletter_title: Any = ...
    subject: Any = ...
    status: CampaignDetailStatus = Field(description='* `draft` - Draft * `sending` - ...')
    status_color: Any = ...
    recipient_count: int = ...
    created_at: datetime.datetime = ...
    sent_at: datetime.datetime | None = None
    email_title: str = Field(max_length=255)
    main_text: str = ...
    main_html_content: str | None = None
    button_text: str | None = Field(None, max_length=100)
    button_url: str | None = Field(None, max_length=200)
    secondary_text: str | None = None
    updated_at: datetime.datetime = ...



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

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

    id: str = ...
    title: Any = ...
    description: Any = ...
    is_active: bool = ...
    auto_subscribe: bool = Field(description='Auto-subscribe new customers to ...')
    subscribers_count: int = ...
    project_slug: Any | None = Field(None, pattern='^[-a-zA-Z0-9_]+$')
    created_at: datetime.datetime = ...



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



