"""Domain models for CleverAgents - auto-generated from Phase 0 stubs."""

from enum import StrEnum

from pydantic import Field

from ..base import DomainBaseModel


class ApiErrorType(StrEnum):
    """Enum for API error types."""

    VALIDATION = "validation"
    AUTH = "auth"
    SERVER = "server"
    BILLING = "billing"
    TRIAL = "trial"
    NOT_FOUND = "not_found"


class AuthHeader(DomainBaseModel):
    """Data contract for AuthHeader."""

    token: str = Field(...)
    org_id: str = Field(..., alias="orgId")
    hash: str = Field(...)


class TrialPlansExceededError(DomainBaseModel):
    """Data contract for TrialPlansExceededError."""

    max_plans: int = Field(..., alias="maxPlans")


class TrialMessagesExceededError(DomainBaseModel):
    """Data contract for TrialMessagesExceededError."""

    max_messages: int = Field(..., alias="maxMessages")


class BillingError(DomainBaseModel):
    """Data contract for BillingError."""

    has_billing_permission: bool = Field(..., alias="hasBillingPermission")
    is_trial: bool = Field(..., alias="isTrial")


class ApiError(DomainBaseModel):
    """Data contract for ApiError."""

    type_: ApiErrorType = Field(...)
    status: int = Field(...)
    msg: str = Field(...)
    trial_plans_exceeded_error: TrialPlansExceededError | None = Field(
        alias="trialPlansExceededError", default=None
    )
    trial_messages_exceeded_error: TrialMessagesExceededError | None = Field(
        alias="trialMessagesExceededError", default=None
    )
    billing_error: BillingError | None = Field(alias="billingError", default=None)


class ClientAccount(DomainBaseModel):
    """Data contract for ClientAccount."""

    is_cloud: bool = Field(..., alias="isCloud")
    host: str = Field(...)
    email: str = Field(...)
    user_name: str = Field(..., alias="userName")
    user_id: str = Field(..., alias="userId")
    token: str = Field(...)
    is_local_mode: bool = Field(..., alias="isLocalMode")
    is_trial: bool = Field(..., alias="isTrial")


class ClientAuth(DomainBaseModel):
    """Data contract for ClientAuth."""

    org_id: str = Field(..., alias="orgId")
    org_name: str = Field(..., alias="orgName")
    org_is_trial: bool = Field(..., alias="orgIsTrial")
    integrated_models_mode: bool = Field(..., alias="integratedModelsMode")
