# 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 .department_membership import DepartmentMembership
from .role_info import RoleInfo
from .status_info import StatusInfo


class MemberResponse(UniversalBaseModel):
    """
    Schema for individual member response.
    """

    id: str = pydantic.Field()
    """
    Organization user ID
    """

    user_id: str = pydantic.Field()
    """
    User ID
    """

    organization_id: str = pydantic.Field()
    """
    Organization ID
    """

    full_name: typing.Optional[str] = pydantic.Field(default=None)
    """
    User's full name
    """

    email: str = pydantic.Field()
    """
    User's email address
    """

    username: typing.Optional[str] = pydantic.Field(default=None)
    """
    User's username
    """

    profile_image: typing.Optional[str] = pydantic.Field(default=None)
    """
    User's profile image URL
    """

    role: RoleInfo = pydantic.Field()
    """
    User's role in the organization
    """

    status: StatusInfo = pydantic.Field()
    """
    User's status in the organization
    """

    joined_at: dt.datetime = pydantic.Field()
    """
    When user joined the organization
    """

    created_at: dt.datetime = pydantic.Field()
    """
    When membership was created
    """

    last_modified_at: dt.datetime = pydantic.Field()
    """
    When membership was last modified
    """

    departments: typing.Optional[typing.List[DepartmentMembership]] = pydantic.Field(default=None)
    """
    Departments the user belongs to
    """

    department_ids: typing.Optional[typing.List[str]] = pydantic.Field(default=None)
    """
    Department IDs for quick filtering
    """

    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
