import { Result } from 'neverthrow';
/**
 * Sample Aggregate Pattern Implementation
 *
 * This demonstrates the Event-Centric Domain Driven Design approach:
 * - Commands produce events, not side effects
 * - Complete rejection of class-based OOP
 * - One business rule = one function
 * - Functional composition with Result types
 */
type PlanEvent = {
    type: 'PlanCreated';
    planId: string;
    plan: Plan;
} | {
    type: 'PlanUpdated';
    planId: string;
    plan: Plan;
} | {
    type: 'PlanDeleted';
    planId: string;
};
type PlanCreated = Extract<PlanEvent, {
    type: 'PlanCreated';
}>;
type PlanUpdated = Extract<PlanEvent, {
    type: 'PlanUpdated';
}>;
type Plan = {
    id: string;
    name: string;
    description: string;
    tasks: Task[];
    createdAt: Date;
    updatedAt: Date;
};
type Task = {
    id: string;
    title: string;
    status: 'todo' | 'in-progress' | 'done';
};
type CreatePlanCommand = (request: CreatePlanRequest) => Result<PlanCreated, PlanError>;
type UpdatePlanCommand = (existingPlan: Plan, request: UpdatePlanRequest) => Result<PlanUpdated, PlanError>;
type CreatePlanRequest = {
    name: string;
    description: string;
    tasks: Array<{
        title: string;
        description: string;
    }>;
};
type UpdatePlanRequest = {
    name?: string;
    description?: string;
    taskUpdates?: Array<{
        id: string;
        status?: 'todo' | 'in-progress' | 'done';
    }>;
};
type PlanError = {
    type: 'ValidationFailed';
    reason: string;
} | {
    type: 'PlanNotFound';
    planId: string;
} | {
    type: 'InvalidStateTransition';
    from: string;
    to: string;
};
/**
 * Plan Aggregate - The public interface for plan-related commands
 *
 * @command createPlan - Create a new work plan
 * @command updatePlan - Update an existing plan
 * @utility toErrorMessage - Convert errors to user-friendly strings
 */
export declare const PlanAggregate: {
    readonly createPlan: CreatePlanCommand;
    readonly updatePlan: UpdatePlanCommand;
    readonly toErrorMessage: (error: PlanError) => string;
};
export {};
//# sourceMappingURL=plan-aggregate-example.d.ts.map