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

from __future__ import annotations
from ..core.unchecked_base_model import UncheckedBaseModel
import typing
import pydantic
from .catalog_category_type import CatalogCategoryType
from .catalog_ecom_seo_data import CatalogEcomSeoData
from .category_path_to_root_node import CategoryPathToRootNode
from ..core.pydantic_utilities import IS_PYDANTIC_V2
from ..core.pydantic_utilities import update_forward_refs


class CatalogCategory(UncheckedBaseModel):
    """
    A category to which a `CatalogItem` instance belongs.
    """

    name: typing.Optional[str] = pydantic.Field(default=None)
    """
    The category name. This is a searchable attribute for use in applicable query filters, and its value length is of Unicode code points.
    """

    image_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    The IDs of images associated with this `CatalogCategory` instance.
    Currently these images are not displayed by Square, but are free to be displayed in 3rd party applications.
    """

    category_type: typing.Optional[CatalogCategoryType] = pydantic.Field(default=None)
    """
    The type of the category.
    See [CatalogCategoryType](#type-catalogcategorytype) for possible values
    """

    parent_category: typing.Optional["CatalogObjectCategory"] = pydantic.Field(default=None)
    """
    The ID of the parent category of this category instance.
    """

    is_top_level: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Indicates whether a category is a top level category, which does not have any parent_category.
    """

    channels: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    A list of IDs representing channels, such as a Square Online site, where the category can be made visible.
    """

    availability_period_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    The IDs of the `CatalogAvailabilityPeriod` objects associated with the category.
    """

    online_visibility: typing.Optional[bool] = pydantic.Field(default=None)
    """
    Indicates whether the category is visible (`true`) or hidden (`false`) on all of the seller's Square Online sites.
    """

    root_category: typing.Optional[str] = pydantic.Field(default=None)
    """
    The top-level category in a category hierarchy.
    """

    ecom_seo_data: typing.Optional[CatalogEcomSeoData] = pydantic.Field(default=None)
    """
    The SEO data for a seller's Square Online store.
    """

    path_to_root: typing.Optional[typing.List[CategoryPathToRootNode]] = pydantic.Field(default=None)
    """
    The path from the category to its root category. The first node of the path is the parent of the category
    and the last is the root category. The path is empty if the category is a root category.
    """

    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


from .catalog_object_category import CatalogObjectCategory  # noqa: E402

update_forward_refs(CatalogCategory)
