/**
 * Identity abstraction — the request-bound caller identity.
 *
 * Framework-agnostic. Adapters construct an Identity (from MWT, JWT,
 * session, etc.) and pass it into dispatch. ANONYMOUS is the default.
 */

export interface Identity {
    isAuthenticated: boolean
    isStaff: boolean
    isSuperuser: boolean
    id: number | string | null
}

export const ANONYMOUS: Identity = {
    isAuthenticated: false,
    isStaff: false,
    isSuperuser: false,
    id: null,
}

export type AuthPredicate = (identity: Identity) => boolean
