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

from .precondition_base import PreconditionBase
import pydantic
import typing
from ...core.pydantic_utilities import IS_PYDANTIC_V2


class MetadataPrecondition(PreconditionBase):
    key: str = pydantic.Field()
    """
    The key that must be present in the metadata for a precondition to be met
    """

    value: typing.Optional[str] = pydantic.Field(default=None)
    """
    If set, the value must match the metadata value for the given key
    """

    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
