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

from ...core.pydantic_utilities import UniversalBaseModel
import typing
from .trade_traversal_path import TradeTraversalPath
from ...core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic


class UpstreamTradeTraversalResponse(UniversalBaseModel):
    """
    Examples
    --------
    from sayari.supply_chain import (
        HsCodeWithDescription,
        TradeTraversalEntity,
        TradeTraversalPath,
        TradeTraversalPathSegment,
        TradeTraversalProduct,
        UpstreamTradeTraversalResponse,
    )

    UpstreamTradeTraversalResponse(
        data=[
            TradeTraversalPath(
                source="ESkH7J-UCRfY5t0_JXIH3w",
                target=TradeTraversalEntity(
                    id="BAQGiWn9riAG10h4NuK_9w",
                    type="company",
                    label="TEXMARK CHEMICALS INC",
                    countries=["USA"],
                    risk=["forced_labor_xinjiang_origin_subtier"],
                ),
                path=[
                    TradeTraversalPathSegment(
                        entity=TradeTraversalEntity(
                            id="ESkH7J-UCRfY5t0_JXIH3w",
                            type="company",
                            label="ACUMEN HOUSEWARE INDUSTRY VIETNAM CO LTD",
                            countries=["VNM"],
                            risk=[],
                        ),
                        products=[
                            TradeTraversalProduct(
                                hs_code=HsCodeWithDescription(
                                    code="3204",
                                    description="Synthetic dyes & agents",
                                ),
                                min_date="2023-04-01",
                                max_date="2024-03-27",
                                arrival_countries=["VNM"],
                                departure_countries=["IND"],
                            )
                        ],
                    ),
                    TradeTraversalPathSegment(
                        entity=TradeTraversalEntity(
                            id="A84F35yJ_3FT_hVzD9EzAw",
                            type="company",
                            label="TOYO INK INDIA PRIVATE LIMITED",
                            countries=["IND"],
                            risk=[
                                "forced_labor_sheffield_hallam_university_reports_origin_subtier",
                                "forced_labor_uflpa_origin_subtier",
                                "forced_labor_xinjiang_origin_subtier",
                            ],
                        ),
                        products=[
                            TradeTraversalProduct(
                                hs_code=HsCodeWithDescription(
                                    code="3206",
                                    description="Other dyes & colorants",
                                ),
                                min_date="2023-03-01",
                                max_date="2024-02-12",
                                arrival_countries=["IND"],
                                departure_countries=["CHN"],
                            )
                        ],
                    ),
                ],
            )
        ],
    )
    """

    status: typing.Optional[int] = None
    success: typing.Optional[bool] = None
    message: typing.Optional[str] = None
    data: typing.List[TradeTraversalPath]

    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
