# 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 .pipeline_processing_details import PipelineProcessingDetails
from .pipeline_record_result import PipelineRecordResult


class PipelineSuccessResponse(UniversalBaseModel):
    """
    Success response for pipeline operations.
    """

    successful: int = pydantic.Field()
    """
    Number of successfully processed records
    """

    failed: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of records that failed processing
    """

    skipped: typing.Optional[int] = pydantic.Field(default=None)
    """
    Number of records that were skipped
    """

    results: typing.Optional[typing.List[PipelineRecordResult]] = pydantic.Field(default=None)
    """
    Detailed results for each record (optional)
    """

    request_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Unique request identifier for tracking
    """

    processing_time_ms: typing.Optional[int] = pydantic.Field(default=None)
    """
    Processing time in milliseconds
    """

    summary: typing.Optional[typing.Dict[str, typing.Optional[typing.Dict[str, typing.Optional[int]]]]] = (
        pydantic.Field(default=None)
    )
    """
    Summary statistics grouped by namespace, source_system, and action
    """

    details: typing.Optional[PipelineProcessingDetails] = pydantic.Field(default=None)
    """
    Detailed breakdown of processing results
    """

    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
