# 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
from .group_member_type_enum import GroupMemberTypeEnum
from .group_type_enum import GroupTypeEnum


class GroupMember(UniversalBaseModel):
    """
    Represents the metadata of a group membership.
    """

    id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Unique identifier for the member.
    """

    member_type: typing.Optional[GroupMemberTypeEnum] = None
    type: typing.Optional[GroupTypeEnum] = None
    connection_id: typing.Optional[str] = pydantic.Field(default=None)
    """
    Identifier for the connection this group belongs to (if a connection group).
    """

    created_at: typing.Optional[dt.datetime] = pydantic.Field(default=None)
    """
    Timestamp of when the membership was created.
    """

    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
