# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Dict, Optional
from datetime import datetime
from typing_extensions import Literal

from ..._models import BaseModel
from .beta_user_profile_trust_grant import BetaUserProfileTrustGrant

__all__ = ["BetaUserProfile"]


class BetaUserProfile(BaseModel):
    id: str
    """Unique identifier for this user profile, prefixed `uprof_`."""

    created_at: datetime
    """A timestamp in RFC 3339 format"""

    metadata: Dict[str, str]
    """Arbitrary key-value metadata.

    Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.
    """

    trust_grants: Dict[str, BetaUserProfileTrustGrant]
    """Trust grants for this profile, keyed by grant name.

    Key omitted when no grant is active or in flight.
    """

    type: Literal["user_profile"]
    """Object type. Always `user_profile`."""

    updated_at: datetime
    """A timestamp in RFC 3339 format"""

    access_type: Optional[Literal["application", "passthrough"]] = None
    """How the platform uses the API on behalf of the entity this profile represents.

    `application`: the platform sells a product that uses the API behind the scenes,
    and the profile represents an individual end-user of that product.
    `passthrough`: the platform resells raw inference, and the profile identifies
    the resold-to company.
    """

    external_id: Optional[str] = None
    """Platform's own identifier for this user. Not enforced unique."""

    name: Optional[str] = None
    """Real-world name of the entity this profile represents (company or individual).

    For a resold-to company (`access_type` `passthrough`, or `relationship` `resold`
    under the `user-profiles-2026-03-24` header) this is that company's name.
    """

    relationship: Optional[Literal["external", "resold", "internal"]] = None
    """
    How the entity behind a user profile relates to the platform that owns the API
    key. `external`: an individual end-user of the platform. `resold`: a company the
    platform resells Claude access to. `internal`: the platform's own usage.
    """
