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

from ...core.pydantic_utilities import UniversalBaseModel
from .resolution_response_fields import ResolutionResponseFields
import typing
from .resolution_result import ResolutionResult
from ...core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic


class ResolutionResponse(UniversalBaseModel):
    """
    Examples
    --------
    from sayari.resolution import (
        MatchExplanation,
        MatchStrength,
        ResolutionResponse,
        ResolutionResponseFields,
        ResolutionResult,
    )
    from sayari.shared_types import Identifier

    ResolutionResponse(
        fields=ResolutionResponseFields(
            name=["Thomas Bangalter"],
            address=["8 AVENUE RACHEL"],
            country=["FRA"],
        ),
        data=[
            ResolutionResult(
                profile="corporate",
                score=453.80554,
                entity_id="1nOeH5G2EhmRVtmeVqO2Lw",
                label="Mr Thomas Bangalter",
                type="person",
                identifiers=[
                    Identifier(
                        type="uk_person_number",
                        value="053673450003",
                        label="Uk Person Number",
                    ),
                    Identifier(
                        type="uk_person_number",
                        value="053673450002",
                        label="Uk Person Number",
                    ),
                ],
                addresses=[
                    "5TH FLOOR 104 OXFORD STREET, W1D 1LP, LONDON, UNITED KINGDOM",
                    "Oxford Street, London, W1D 1LP",
                    "8 AVENUE RACHEL, 75018, FRANCE",
                    "4th Floor, 205 Wardour Street, London, W1F 8ZJ",
                    "MSE BUSINESS MANAGEMENT LLP 4TH FLOOR, 205 WARDOUR STREET, W1F 8ZJ, UNITED KINGDOM",
                ],
                countries=["FRA", "GBR"],
                sources=[
                    "ecdfb3f2ecc8c3797e77d5795a8066ef",
                    "4ea8bac1bed868e1510ffd21842e9551",
                ],
                typed_matched_queries=[
                    "address|sub|phraseStripped|0",
                    "name|100match|0",
                    "address|subclause|0",
                    "address|numericFirst|0",
                    "address|numericFull|0",
                    "address|V2|Strict|0",
                    "name|StrictV2|0",
                    "address|V3|0",
                    "name|100phrase|0",
                    "country|0",
                    "address|sub|cleanedAddress|0",
                    "address|sub|phraseFirstHalf|0",
                ],
                matched_queries=["address", "name", "identifier", "country"],
                highlight={
                    "name": ["Mr <em>Thomas</em> <em>Bangalter</em>"],
                    "address": [
                        "<em>8</em> <em>AVENUE</em> <em>RACHEL</em>, 75018, FRANCE"
                    ],
                    "country": ["<em>FRA</em>"],
                },
                explanation={
                    "name": [
                        MatchExplanation(
                            matched="Mr <em>Thomas</em> <em>Bangalter</em>",
                            uploaded="Thomas Bangalter",
                            high_quality_match_name=True,
                            scores={
                                "tf": 0.35648895767689204,
                                "lv": 0.9142857142857143,
                                "fz": 0.8421052631578947,
                                "l1": 1.0,
                                "l2": 1.0,
                            },
                            n_common_term_matches=1,
                            n_uncommon_term_matches=1,
                        )
                    ],
                    "address": [
                        MatchExplanation(
                            matched="<em>8</em> <em>AVENUE</em> <em>RACHEL</em>, 75018, FRANCE",
                            uploaded="8 AVENUE RACHEL",
                            match_quality="medium",
                            scores={"9p": 0.47058823529411764},
                        )
                    ],
                    "country": [
                        MatchExplanation(
                            matched="<em>FRA</em>",
                            uploaded="FRA",
                        )
                    ],
                },
                match_strength=MatchStrength(
                    value="strong",
                ),
            )
        ],
    )
    """

    fields: ResolutionResponseFields
    data: typing.List[ResolutionResult]

    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
