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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from .catalog_bulk_response_errors_item import CatalogBulkResponseErrorsItem
from .catalog_bulk_response_skipped_item import CatalogBulkResponseSkippedItem


class CatalogBulkResponse(UniversalBaseModel):
    """
    Response for bulk create/update operations
    """

    success_count: int = pydantic.Field()
    """
    Total successful operations (created + updated)
    """

    created_count: int = pydantic.Field()
    """
    Number of records created
    """

    updated_count: int = pydantic.Field()
    """
    Number of records updated
    """

    error_count: int = pydantic.Field()
    """
    Number of failed operations
    """

    skipped_count: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of entries skipped — already exist with identical data, no changes detected
    """

    created: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = pydantic.Field(default=None)
    """
    List of created records
    """

    updated: typing.Optional[typing.List[typing.Dict[str, typing.Any]]] = pydantic.Field(default=None)
    """
    List of updated records
    """

    skipped: typing.Optional[typing.List[CatalogBulkResponseSkippedItem]] = pydantic.Field(default=None)
    """
    Entries skipped due to no field changes
    """

    errors: typing.Optional[typing.List[CatalogBulkResponseErrorsItem]] = pydantic.Field(default=None)
    """
    List of errors
    """

    prices_created: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of prices created (if applicable)
    """

    prices_updated: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of prices updated (if applicable)
    """

    allowances_created: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of allowances created (if applicable)
    """

    allowances_updated: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of allowances updated (if applicable)
    """

    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
