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

from ...core.pydantic_utilities import UniversalBaseModel
from .project_entity_risk_summary_data import ProjectEntityRiskSummaryData
from .project_entity_risk_summary_response_filters import ProjectEntityRiskSummaryResponseFilters
from ...core.pydantic_utilities import IS_PYDANTIC_V2
import typing
import pydantic


class ProjectEntityRiskSummaryResponse(UniversalBaseModel):
    """
    Examples
    --------
    from sayari.project_entity import (
        ProjectEntityRiskSummaryData,
        ProjectEntityRiskSummaryNetworkPath,
        ProjectEntityRiskSummaryResponse,
        ProjectEntityRiskSummaryResponseFilters,
        ProjectEntityRiskSummaryRiskFactor,
        ProjectRiskCategory,
        ShareInformation,
    )

    ProjectEntityRiskSummaryResponse(
        data=ProjectEntityRiskSummaryData(
            project_entity_id="GleDrP",
            project_id="8YMJNG",
            risk_factors=[
                ProjectEntityRiskSummaryRiskFactor(
                    id="imports_ilab_child_labor",
                    label="Imports Goods with ILAB Child Labor Risk",
                    value="true",
                    level="elevated",
                    source_entity_ids=["FFgmjk4bK6vDn25yMypciw"],
                    metadata=[
                        {
                            "traversal_path": [
                                "FFgmjk4bK6vDn25yMypciw|receiver_of|QB7r598_7sPrCNefvZrAyw"
                            ],
                            "origin_shipment_product": [
                                "640299",
                                "5705",
                                "62",
                                "5702",
                                "64",
                                "42",
                            ],
                        }
                    ],
                    risk_intelligence=[
                        {
                            "type": "financial_risk_score",
                            "score": 36,
                            "Label": "S&P RiskGauge Credit Risk",
                        }
                    ],
                    risk_categories=[
                        ProjectRiskCategory(
                            id="forced_labor",
                            label="Forced labor",
                            risk_factors=["imports_ilab_child_labor"],
                        )
                    ],
                    network_paths=[[]],
                ),
                ProjectEntityRiskSummaryRiskFactor(
                    id="forced_labor_xinjiang_origin_subtier",
                    label="Supplier Network with Xinjiang-Based Entity",
                    value=2,
                    level="elevated",
                    source_entity_ids=["FFgmjk4bK6vDn25yMypciw"],
                    metadata=[
                        {
                            "traversal_path": [
                                "FFgmjk4bK6vDn25yMypciw|receives_from|doWJaXqr57DBYPyHcF_BxQ|receives_from|A3YwnnynaDQnlinlbt-UlQ"
                            ]
                        }
                    ],
                    risk_intelligence=[
                        {
                            "type": "financial_risk_score",
                            "score": 36,
                            "Label": "S&P RiskGauge Credit Risk",
                        }
                    ],
                    risk_categories=[
                        ProjectRiskCategory(
                            id="forced_labor",
                            label="Forced labor",
                            risk_factors=["forced_labor_xinjiang_origin_subtier"],
                        )
                    ],
                    network_paths=[
                        [
                            ProjectEntityRiskSummaryNetworkPath(
                                sayari_entity_id="doWJaXqr57DBYPyHcF_BxQ",
                                sayari_entity_label="LIBERTY MILLS LIMITED",
                                relationship_type="receives_from",
                                relationship_status="active",
                                former=False,
                                first_observed="2024-03-08",
                                last_observed="2024-03-14",
                                start_date="2024-03-08",
                                shares=ShareInformation(),
                            ),
                            ProjectEntityRiskSummaryNetworkPath(
                                sayari_entity_id="A3YwnnynaDQnlinlbt-UlQ",
                                sayari_entity_label="XINXIANG CHEMICAL FIBRE CO., LTD",
                                relationship_type="receives_from",
                                relationship_status="active",
                                former=False,
                                first_observed="2024-03-11",
                                last_observed="2024-03-25",
                                start_date="2024-03-11",
                                shares=ShareInformation(),
                            ),
                        ]
                    ],
                ),
                ProjectEntityRiskSummaryRiskFactor(
                    id="forced_labor_sheffield_hallam_university_reports_origin_subtier",
                    label="Supplier Network with Entity from Sheffield Hallam University Forced Labor Reports",
                    value=2,
                    level="elevated",
                    source_entity_ids=["FFgmjk4bK6vDn25yMypciw"],
                    metadata=[
                        {
                            "traversal_path": [
                                "FFgmjk4bK6vDn25yMypciw|receives_from|hky4niXTOuJOZ3YJUHBvpw|receives_from|jcG2-gcTVXhH6J2UO7bASg"
                            ]
                        }
                    ],
                    risk_intelligence=[
                        {
                            "type": "financial_risk_score",
                            "score": 36,
                            "Label": "S&P RiskGauge Credit Risk",
                        }
                    ],
                    risk_categories=[
                        ProjectRiskCategory(
                            id="forced_labor",
                            label="Forced labor",
                            risk_factors=[
                                "forced_labor_sheffield_hallam_university_reports_origin_subtier"
                            ],
                        )
                    ],
                    network_paths=[
                        [
                            ProjectEntityRiskSummaryNetworkPath(
                                sayari_entity_id="hky4niXTOuJOZ3YJUHBvpw",
                                sayari_entity_label="KOHINOOR TEXTILE MILLS LIMITED",
                                relationship_type="receives_from",
                                relationship_status="active",
                                former=False,
                                first_observed="2023-09-27",
                                last_observed="2023-09-27",
                                start_date="2023-09-27",
                                shares=ShareInformation(),
                            ),
                            ProjectEntityRiskSummaryNetworkPath(
                                sayari_entity_id="jcG2-gcTVXhH6J2UO7bASg",
                                sayari_entity_label="WEIQIAO TEXTILE COMPANY LIMITED",
                                relationship_type="receives_from",
                                relationship_status="active",
                                former=False,
                                first_observed="2017-03-08",
                                last_observed="2025-04-21",
                                start_date="2017-03-08",
                                shares=ShareInformation(),
                            ),
                        ]
                    ],
                ),
                ProjectEntityRiskSummaryRiskFactor(
                    id="forced_labor_uflpa_origin_subtier",
                    label="Supplier Network with UFLPA Entity",
                    value=3,
                    level="elevated",
                    source_entity_ids=["FFgmjk4bK6vDn25yMypciw"],
                    metadata=[
                        {
                            "traversal_path": [
                                "FFgmjk4bK6vDn25yMypciw|receives_from|Lg1BHckRWGrKUT03LUy3iw|receives_from|rmgKmpNeQxhVNnrnemI2yQ|receives_from|CZAZypVNS-jkOGzpRpCXEw"
                            ]
                        }
                    ],
                    risk_intelligence=[
                        {
                            "type": "financial_risk_score",
                            "score": 36,
                            "Label": "S&P RiskGauge Credit Risk",
                        }
                    ],
                    risk_categories=[
                        ProjectRiskCategory(
                            id="forced_labor",
                            label="Forced labor",
                            risk_factors=["forced_labor_uflpa_origin_subtier"],
                        )
                    ],
                    network_paths=[
                        [
                            ProjectEntityRiskSummaryNetworkPath(
                                sayari_entity_id="Lg1BHckRWGrKUT03LUy3iw",
                                sayari_entity_label="KAMAL LIMITED",
                                relationship_type="receives_from",
                                relationship_status="active",
                                former=False,
                                first_observed="2024-04-29",
                                last_observed="2025-04-21",
                                start_date="2024-04-29",
                                shares=ShareInformation(),
                            ),
                            ProjectEntityRiskSummaryNetworkPath(
                                sayari_entity_id="rmgKmpNeQxhVNnrnemI2yQ",
                                sayari_entity_label="CôNG TY TRáCH NHIệM HữU HạN HYOSUNG ĐồNG NAI",
                                relationship_type="receives_from",
                                relationship_status="active",
                                former=False,
                                first_observed="2023-09-28",
                                last_observed="2025-04-13",
                                start_date="2023-09-28",
                                shares=ShareInformation(),
                            ),
                            ProjectEntityRiskSummaryNetworkPath(
                                sayari_entity_id="CZAZypVNS-jkOGzpRpCXEw",
                                sayari_entity_label="HANGZHOU UNION BIOTECHNOLOGY CO., LTD",
                                relationship_type="receives_from",
                                relationship_status="active",
                                former=False,
                                first_observed="2023-03-09",
                                last_observed="2025-02-27",
                                start_date="2023-03-09",
                                shares=ShareInformation(),
                            ),
                        ]
                    ],
                ),
            ],
        ),
        filters=ProjectEntityRiskSummaryResponseFilters(
            risk_factor=[
                "imports_ilab_child_labor",
                "forced_labor_xinjiang_origin_subtier",
            ],
            risk_category=["forced_labor"],
        ),
    )
    """

    data: ProjectEntityRiskSummaryData
    filters: ProjectEntityRiskSummaryResponseFilters

    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
