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

from ..core.pydantic_utilities import UniversalBaseModel
import pydantic
import typing
from .guideline import Guideline
from .tag import Tag
from .tool import Tool
from .relationship_kind_dto import RelationshipKindDto
from ..core.pydantic_utilities import IS_PYDANTIC_V2


class Relationship(UniversalBaseModel):
    """
    Represents a relationship.

    Only one of `source_guideline` and `source_tag` can have a value.
    Only one of `target_guideline` and `target_tag` can have a value.
    Only one of `source_tool` and `target_tool` can have a value.
    """

    id: str = pydantic.Field()
    """
    Unique identifier for the relationship
    """

    source_guideline: typing.Optional[Guideline] = None
    source_tag: typing.Optional[Tag] = None
    target_guideline: typing.Optional[Guideline] = None
    target_tag: typing.Optional[Tag] = None
    source_tool: typing.Optional[Tool] = None
    target_tool: typing.Optional[Tool] = None
    kind: RelationshipKindDto

    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
