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

import datetime as dt
import typing

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


class UpsertUserRequestBody(UniversalBaseModel):
    companies: typing.Optional[typing.List[typing.Dict[str, str]]] = pydantic.Field(default=None)
    """
    Optionally specify companies using array of key/value pairs
    """

    company: typing.Optional[typing.Dict[str, str]] = pydantic.Field(default=None)
    """
    Add user to this company. Takes priority over companies. For exhaustive list of companies, use companies
    """

    company_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Add user to this company. Takes priority over company_ids. For exhaustive list of companies, use company_ids
    """

    company_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Optionally specify companies using Schematic company ID
    """

    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    If you know the Schematic ID, you can use that here instead of keys
    """

    keys: typing.Dict[str, str] = pydantic.Field()
    """
    See [Key Management](https://docs.schematichq.com/developer_resources/key_management) for more information
    """

    last_seen_at: typing.Optional[dt.datetime] = None
    name: typing.Optional[str] = None
    traits: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
    """
    A map of trait names to trait values
    """

    update_only: typing.Optional[bool] = None

    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
