# 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 CustomerInvoiceDetailStatus, CustomerTransactionResponseTransactionType, CustomerWithdrawalResponseStatus


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

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

    id: str = ...
    transaction_type: CustomerTransactionResponseTransactionType = Field(
    description='* `deposit` - Deposit * `withdra...',
)
    amount_usd: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    balance_after: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    invoice: str | None = None
    withdrawal: str | None = None
    description: Any = ...
    created_at: datetime.datetime = ...



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



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

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

    id: str = ...
    amount_usd: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    fee_usd: Any = Field(pattern='^-?\\d{0,8}(?:\\.\\d{0,2})?$')
    final_amount_usd: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    network: Any = ...
    wallet_address: Any = ...
    status: CustomerWithdrawalResponseStatus = Field(
    description='* `pending` - Pending * `approve...',
)
    tx_id: Any | None = None
    created_at: datetime.datetime = ...



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

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

    id: str = ...
    project: str = ...
    title: str = Field(max_length=200)
    description: str | None = None
    amount_usd: Any | None = Field(
    None,
    description='Fixed amount. Null = buyer chooses.',
    pattern='^-?\\d{0,8}(?:\\.\\d{0,2})?$',
)
    network: str | None = Field(None, max_length=20)
    exchange: str | None = Field(None, max_length=20)
    is_active: bool | None = None
    success_url: str | None = Field(None, max_length=200)
    metadata: dict[str, Any] | None = None
    total_payments: int = ...
    total_collected_usd: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    created_at: datetime.datetime = ...



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



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

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

    id: str = ...
    transaction_type: CustomerTransactionResponseTransactionType = Field(
    description='* `deposit` - Deposit * `withdra...',
)
    amount_usd: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    balance_after: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    invoice: str | None = None
    withdrawal: str | None = None
    description: Any = ...
    created_at: datetime.datetime = ...



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



class CustomerInvoiceDetail(BaseModel):
    """
    Full invoice details for customer.

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

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

    id: str = ...
    amount_usd: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    pay_amount: Any = Field(
    description='Unique amount with fractional su...',
    pattern='^-?\\d{0,14}(?:\\.\\d{0,6})?$',
)
    actual_amount: Any | None = Field(
    None,
    description='Actual amount received from exch...',
    pattern='^-?\\d{0,12}(?:\\.\\d{0,8})?$',
)
    pay_address: Any = ...
    coin: Any = ...
    network: Any = ...
    exchange: Any = ...
    status: CustomerInvoiceDetailStatus = Field(description='* `created` - Created * `waiting...')
    tx_id: Any | None = None
    confirm_times: Any = Field(description='Confirmation progress, e.g. "3/12"')
    description: Any = ...
    expires_at: datetime.datetime = ...
    completed_at: datetime.datetime | None = None
    created_at: datetime.datetime = ...



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



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

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

    invoice_id: str = ...
    amount_usd: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    pay_amount: Any = Field(pattern='^-?\\d{0,14}(?:\\.\\d{0,6})?$')
    pay_address: str = ...
    coin: str = ...
    network: str = ...
    exchange: str = ...
    status: str = ...
    expires_at: datetime.datetime = ...



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

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

    id: str = ...
    project: str = ...
    customer: str = ...
    amount_usd: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    pay_amount: Any = Field(
    description='Unique amount with fractional su...',
    pattern='^-?\\d{0,14}(?:\\.\\d{0,6})?$',
)
    actual_amount: Any | None = Field(
    None,
    description='Actual amount received from exch...',
    pattern='^-?\\d{0,12}(?:\\.\\d{0,8})?$',
)
    pay_address: Any = ...
    coin: Any = ...
    network: Any = ...
    exchange: Any = ...
    status: CustomerInvoiceDetailStatus = Field(description='* `created` - Created * `waiting...')
    tx_id: Any | None = None
    confirm_times: Any = Field(description='Confirmation progress, e.g. "3/12"')
    description: Any = ...
    expires_at: datetime.datetime = ...
    completed_at: datetime.datetime | None = None
    created_at: datetime.datetime = ...



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



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

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

    amount_usd: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    network: str | None = Field(None, min_length=1)
    exchange: str | None = Field(None, min_length=1)
    description: str | None = None
    customer_id: str = ...
    project_slug: str = Field(min_length=1, pattern='^[-a-zA-Z0-9_]+$')



class PaymentLinkPayInputRequest(BaseModel):
    """
    Input for paying via a payment link.

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

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

    email: str | None = Field(None, min_length=1)
    name: str | None = None
    amount_usd: Any | None = Field(None, pattern='^-?\\d{0,8}(?:\\.\\d{0,2})?$')
    external_id: str | None = Field(None, min_length=1)



class CustomerInvoiceResponse(BaseModel):
    """
    Compact response after creating an invoice.

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

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

    invoice_id: str = ...
    amount_usd: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    pay_amount: Any = Field(pattern='^-?\\d{0,14}(?:\\.\\d{0,6})?$')
    pay_address: str = ...
    coin: str = ...
    network: str = ...
    exchange: str = ...
    status: str = ...
    expires_at: datetime.datetime = ...



class PaymentLinkCreateRequest(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=200)
    description: str | None = None
    amount_usd: Any | None = Field(None, pattern='^-?\\d{0,8}(?:\\.\\d{0,2})?$')
    network: str | None = Field(None, min_length=1)
    exchange: str | None = Field(None, min_length=1)
    success_url: str | None = None
    project_slug: str = Field(min_length=1, pattern='^[-a-zA-Z0-9_]+$')
    metadata: dict[str, Any] | None = None



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

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

    amount_usd: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    network: str = Field(min_length=1)
    wallet_address: str = Field(min_length=1, max_length=255)
    customer_id: str = ...
    project_slug: str = Field(min_length=1, pattern='^[-a-zA-Z0-9_]+$')



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

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

    balance_usd: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    total_deposited: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    total_withdrawn: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    last_transaction_at: datetime.datetime | None = None



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



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

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

    id: str = ...
    project: str = ...
    customer: str = ...
    amount_usd: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    fee_usd: Any = Field(pattern='^-?\\d{0,8}(?:\\.\\d{0,2})?$')
    final_amount_usd: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    network: Any = ...
    wallet_address: Any = ...
    status: CustomerWithdrawalResponseStatus = Field(
    description='* `pending` - Pending * `approve...',
)
    tx_id: Any | None = None
    created_at: datetime.datetime = ...



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

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

    balance_usd: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    total_deposited: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    total_withdrawn: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    last_transaction_at: datetime.datetime | None = None



class PaymentLinkPublic(BaseModel):
    """
    Public view — no ownership data.

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

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

    id: str = ...
    title: Any = ...
    description: Any = ...
    amount_usd: Any | None = Field(
    None,
    description='Fixed amount. Null = buyer chooses.',
    pattern='^-?\\d{0,8}(?:\\.\\d{0,2})?$',
)
    network: Any = ...
    exchange: Any = ...
    success_url: str = ...



class CustomerWithdrawalCreateRequest(BaseModel):
    """
    Input for customer creating a withdrawal.

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

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

    amount_usd: Any = Field(pattern='^-?\\d{0,10}(?:\\.\\d{0,2})?$')
    network: str = Field(min_length=1)
    wallet_address: str = Field(min_length=1, max_length=255)



