/**
 * A Sanity reference to an `ailf.team` document.
 *
 * Members of an array (`AilfUser.teams[]`) carry a `_key`; the single-valued
 * `preferences.primaryTeam` does not. The team slug downstream consumers need
 * is a derived, read-time value from a GROQ projection — never stored here.
 */
export interface TeamReference {
    _type: "reference";
    _ref: string;
    _key?: string;
}
/**
 * Per-user UI preferences. Room to grow (default view, density, …) — kept
 * minimal for v0 (YAGNI).
 */
export interface AilfUserPreferences {
    /**
     * Reference to the user's default team — one of `AilfUser.teams[]`. Distinct
     * from `teams[]` so "which team's view do I default to" can differ from "all
     * teams I affiliate with". The slug is derived in GROQ at read time.
     */
    primaryTeam?: TeamReference;
}
/**
 * Per-account user document — one per Sanity account, keyed by a deterministic
 * `_id` of `ailf.user.${sanityUserId}`. Stores self-declared team affiliation
 * (references to `ailf.team`) plus UI preferences, and is the primary source
 * for dashboard personalization. Stores minimal PII: `sanityUserId`, `email`,
 * and `displayName` only.
 *
 * @see docs/design-docs/user-settings.md
 */
export interface AilfUser {
    /** Deterministic: `ailf.user.${sanityUserId}`. */
    _id: string;
    _type: "ailf.user";
    /** `CurrentUser.id` — the stable, globally-unique key, mirrored for GROQ. */
    sanityUserId: string;
    /** Denormalized for display / joins (lowercased at write time). */
    email: string;
    /** `CurrentUser.name` snapshot. */
    displayName?: string;
    /** Self-declared affiliation — drives personalization only. */
    teams: TeamReference[];
    preferences: AilfUserPreferences;
    /** ISO 8601 UTC — stamped on each save. */
    updatedAt: string;
}
