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

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel


class EventBodyFlagCheck(UniversalBaseModel):
    company_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Schematic company ID (starting with 'comp_') of the company evaluated, if any
    """

    error: typing.Optional[str] = pydantic.Field(default=None)
    """
    Report an error that occurred during the flag check
    """

    flag_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Schematic flag ID (starting with 'flag_') for the flag matching the key, if any
    """

    flag_key: str = pydantic.Field()
    """
    The key of the flag being checked
    """

    reason: str = pydantic.Field()
    """
    The reason why the value was returned
    """

    req_company: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None)
    """
    Key-value pairs used to to identify company for which the flag was checked
    """

    req_user: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None)
    """
    Key-value pairs used to to identify user for which the flag was checked
    """

    rule_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Schematic rule ID (starting with 'rule_') of the rule that matched for the flag, if any
    """

    user_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Schematic user ID (starting with 'user_') of the user evaluated, if any
    """

    value: bool = pydantic.Field()
    """
    The value of the flag for the given company and/or user
    """

    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
