/**
 * Sample Read Model Implementation
 *
 * This demonstrates the Read Model pattern for CQRS architecture:
 * - Event projections to build read-optimized views
 * - Query functions for retrieving specific view slices
 * - Statistics and analytics computation
 * - Optimized for read performance, not write consistency
 */
type DomainEvent = {
    type: 'PlanCreated';
    planId: string;
    plan: Plan;
} | {
    type: 'PlanUpdated';
    planId: string;
    plan: Plan;
} | {
    type: 'TaskStatusChanged';
    taskId: string;
    planId: string;
    newStatus: TaskStatus;
} | {
    type: 'TasksAdded';
    planId: string;
    taskIds: string[];
} | {
    type: 'DependenciesChanged';
    taskId: string;
    planId: string;
    newDeps: string[];
};
type Plan = {
    id: string;
    name: string;
    description: string;
    tasks: Task[];
    createdAt: Date;
    updatedAt: Date;
};
type Task = {
    id: string;
    title: string;
    description: string;
    status: TaskStatus;
    branch: string;
    dependencies: string[];
    assignedWorktree?: string;
    createdAt: Date;
    updatedAt: Date;
};
type TaskStatus = {
    type: 'ToBeRefined';
} | {
    type: 'Refined';
} | {
    type: 'Implemented';
} | {
    type: 'Reviewed';
} | {
    type: 'Merged';
} | {
    type: 'Blocked';
    reason: string;
} | {
    type: 'Abandoned';
    reason: string;
};
type LineId = string & {
    readonly _brand: 'LineId';
};
type LineState = {
    type: 'NotStarted';
} | {
    type: 'InProgress';
} | {
    type: 'Completed';
} | {
    type: 'Blocked';
} | {
    type: 'Abandoned';
};
type LineExecutability = {
    isExecutable: boolean;
    isAssigned: boolean;
    isCompleted: boolean;
    blockedBy: LineId[];
};
type LineView = {
    readonly id: LineId;
    readonly name: string;
    readonly branch: string;
    readonly tasks: readonly Task[];
    readonly dependencies: readonly LineId[];
    readonly state: LineState;
    readonly executability: LineExecutability;
};
type CorePlanStats = {
    readonly totalTasks: number;
    readonly totalLines: number;
    readonly tasksByStatus: Readonly<Record<string, number>>;
    readonly tasksByBranch: Readonly<Record<string, number>>;
    readonly estimatedTotalHours?: number;
};
type ParallelExecutionStats = {
    readonly executableLines: number;
    readonly unassignedLines: number;
    readonly executableUnassignedLines: number;
    readonly blockedLines: number;
    readonly completedLines: number;
};
type ViewConstructionConfig = {
    readonly includeCompletedLines?: boolean;
    readonly includeDetailedStats?: boolean;
    readonly includeRecommendations?: boolean;
    readonly maxAge?: number;
    readonly cacheKey?: string;
};
type BasePlanView = {
    readonly plan: Plan;
    readonly lines: readonly LineView[];
    readonly stats: CorePlanStats;
    readonly lastUpdated: Date;
};
type TrackingPlanView = {
    readonly plan: Plan;
    readonly lines: readonly LineView[];
    readonly stats: CorePlanStats & {
        readonly parallelExecutionStats: ParallelExecutionStats;
    };
    readonly lastUpdated: Date;
};
/**
 * Plan View Queries - General purpose plan viewing
 */
export declare const planViewQueries: {
    readonly fromPlan: (plan: Plan, config?: ViewConstructionConfig) => BasePlanView;
    readonly fromEvents: (events: DomainEvent[], config?: ViewConstructionConfig) => BasePlanView | null;
};
/**
 * Track View Queries - Project tracking and parallel execution analysis
 */
export declare const trackViewQueries: {
    readonly fromPlan: (plan: Plan, config?: ViewConstructionConfig) => TrackingPlanView;
    readonly fromEvents: (events: DomainEvent[], config?: ViewConstructionConfig) => TrackingPlanView | null;
};
/**
 * Projection Utilities - For building custom read models
 */
export declare const projectionUtils: {
    readonly projectPlanFromEvents: (events: DomainEvent[]) => Plan | null;
    readonly deriveLineViewsFromPlan: (plan: Plan) => LineView[];
    readonly calculateLineExecutability: (line: LineView, allLines: readonly LineView[]) => LineExecutability;
    readonly calculateCorePlanStats: (plan: Plan, lines: readonly LineView[]) => CorePlanStats;
    readonly calculateParallelExecutionStats: (lines: readonly LineView[]) => ParallelExecutionStats;
};
export {};
//# sourceMappingURL=read-model-example.d.ts.map