import { Position } from '../types/base.js'; import { SelectionTarget } from '../types/address.js'; import { AdapterMutationFailure } from '../types/adapter-result.js'; import { DiscoveryOutput } from '../types/discovery.js'; import { StoryLocator } from '../types/story.types.js'; export type PermissionRangePrincipal = { kind: 'everyone'; } | { kind: 'editor'; id: string; }; /** Trusted host roster entry. Names are display labels, never permission identities. */ export interface PermissionRangeEditor { id?: string | null; email?: string | null; name?: string | null; } export type PermissionRangeEditorResolution = { status: 'resolved'; id: string; editor: PermissionRangeEditor; principal: Extract; } | { status: 'unknown' | 'ambiguous'; id: string; }; export type PermissionRangeKind = 'inline' | 'block'; export interface PermissionRangeInfo { id: string; principal: PermissionRangePrincipal; kind: PermissionRangeKind; start: Position; end: Position; /** Story containing this range. Omit for body (backward compatible). */ story?: StoryLocator; } export interface PermissionRangesListInput { limit?: number; offset?: number; } export interface PermissionRangesGetInput { id: string; } export interface PermissionRangesCreateInput { /** Target range for the new permission markers. Uses the standard selection target model. */ target: SelectionTarget; principal: PermissionRangePrincipal; id?: string; } export interface PermissionRangesRemoveInput { id: string; } export interface PermissionRangesUpdatePrincipalInput { id: string; principal: PermissionRangePrincipal; } export interface PermissionRangeMutationSuccess { success: true; range: PermissionRangeInfo; } export interface PermissionRangeRemoveSuccess { success: true; id: string; } export type PermissionRangeMutationResult = PermissionRangeMutationSuccess | AdapterMutationFailure; export type PermissionRangeRemoveResult = PermissionRangeRemoveSuccess | AdapterMutationFailure; export type PermissionRangesListResult = DiscoveryOutput;