# 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 EmailMessageListStatus


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

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

    id: str = ...
    account_alias: Any = ...
    to_email: str = ...
    subject: Any = ...
    status: EmailMessageListStatus = Field(description='* `queued` - Queued * `sent` - S...')
    error: Any = ...
    sent_at: datetime.datetime | None = None
    created_at: datetime.datetime = ...



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

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

    id: str = ...
    alias: Any = Field(description="Human-readable name, e.g. 'notif...")
    smtp_host: Any = ...
    smtp_port: int = ...
    smtp_username: Any = ...
    from_email: str = ...
    from_name: Any = ...
    use_tls: bool = ...
    use_ssl: bool = ...
    is_active: bool = ...
    is_default: bool = Field(description='Default account for this user')
    total_sent: int = ...
    total_failed: int = ...
    last_sent_at: datetime.datetime | None = None
    created_at: datetime.datetime = ...



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

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

    account_alias: str | None = Field(
    None,
    description='Account alias. Uses default if o...',
    min_length=1,
)
    to: str = Field(min_length=1)
    cc: str | None = Field(None, min_length=1)
    bcc: str | None = Field(None, min_length=1)
    subject: str = Field(min_length=1, max_length=500)
    body: str | None = Field(None, description='Plain text body', min_length=1)
    html: str | None = Field(None, description='HTML body', min_length=1)



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

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

    message_id: str = ...
    status: str = ...
    to: str = ...
    subject: str = ...



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

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

    alias: str = Field(min_length=1, max_length=100)
    smtp_host: str = Field(min_length=1, max_length=255)
    smtp_port: int | None = None
    smtp_username: str = Field(min_length=1, max_length=255)
    smtp_password: str = Field(min_length=1)
    from_email: str = Field(min_length=1)
    from_name: str | None = Field(None, min_length=1, max_length=200)
    use_tls: bool | None = None
    use_ssl: bool | None = None
    is_default: bool | None = None



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

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

    ok: bool = ...
    message: str = ...



