# This file was auto-generated by Fern from our API Definition.

from ..core.pydantic_utilities import UniversalBaseModel
import pydantic
import typing
import datetime as dt
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class Plan(UniversalBaseModel):
    id: str = pydantic.Field()
    """
    The ID of the plan
    """

    name: typing.Optional[str] = None
    total_users: typing.Optional[int] = None
    total_indexes: typing.Optional[int] = None
    total_indexed_pages: typing.Optional[int] = None
    credits: typing.Optional[int] = None
    has_payment_method: typing.Optional[bool] = None
    free: typing.Optional[bool] = pydantic.Field(default=None)
    """
    If is a free plan
    """

    allowed_index: typing.Optional[bool] = pydantic.Field(default=None)
    """
    If is allowed to use indexes
    """

    allowed_external_index: typing.Optional[bool] = pydantic.Field(default=None)
    """
    If is allowed to use external data sources or sinks in indexes
    """

    starting_on: typing.Optional[dt.datetime] = None
    ending_before: typing.Optional[dt.datetime] = None

    if IS_PYDANTIC_V2:
        model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True)  # type: ignore # Pydantic v2
    else:

        class Config:
            frozen = True
            smart_union = True
            extra = pydantic.Extra.allow
