import type { GoalId, MutationContext, PlanningSessionId, PlanningTurnId, ProjectId } from "@awp/contracts";
import type { Goal, PlanningDeferral, PlanningInterviewerResolvedSelection, PlanningInterviewerSelection, PlanningParticipationMode, PlanningProfileKind, PlanningSession, ProjectPlanningDefaults } from "@awp/domain";
import type { Clock, IdGenerator } from "./ports/runtime.js";
import type { UnitOfWork } from "./ports/repositories.js";
import type { I1LifecycleService } from "./golive.js";
import type { ExecutionSelection } from "./execution.js";
export interface StartPlanningInput {
    readonly projectId: ProjectId;
    readonly title: string;
    readonly intent: string;
    readonly goalIds?: readonly GoalId[];
    readonly mode?: PlanningParticipationMode;
    readonly context: MutationContext;
}
export interface OnboardProjectInput {
    readonly name: string;
    readonly repositoryUrl: string;
    readonly intent: string;
    readonly vision?: string;
    readonly goalTitle?: string;
    readonly successCriteria?: readonly string[];
    readonly mode?: PlanningParticipationMode;
    readonly context: MutationContext;
}
export interface ResolvePlanningItemInput {
    readonly sessionId: PlanningSessionId;
    readonly itemKey: string;
    readonly answer?: string;
    readonly context: MutationContext;
}
export interface DeferPlanningItemInput {
    readonly sessionId: PlanningSessionId;
    readonly itemKey: string;
    readonly reason: string;
    readonly blockingAt: PlanningDeferral["blockingAt"];
    readonly consequence: string;
    readonly revisit: string;
    readonly context: MutationContext;
}
export interface PlanningLaunchInput {
    readonly sessionId: PlanningSessionId;
    readonly choice: "start" | "schedule" | "park";
    readonly scheduledFor?: string;
    readonly timezone?: string;
    readonly selection?: ExecutionSelection;
    readonly context: MutationContext;
}
export type PlannerStructuredDisposition = {
    readonly kind: "resolve";
    readonly itemKey: string;
    readonly answer: string;
    readonly nextItemKey?: string;
} | {
    readonly kind: "continue" | "none";
    readonly itemKey?: string;
} | {
    readonly kind: "defer";
    readonly itemKey: string;
    readonly reason: string;
    readonly blockingAt: PlanningDeferral["blockingAt"];
    readonly consequence: string;
    readonly revisit: string;
    readonly nextItemKey?: string;
};
export interface ApplyPlannerTurnInput {
    readonly sessionId: PlanningSessionId;
    readonly expectedRevision: number;
    readonly userTurnId: PlanningTurnId;
    readonly plannerTurnId: PlanningTurnId;
    readonly userMessage: string;
    readonly plannerMessage: string;
    readonly selection: PlanningInterviewerResolvedSelection;
    readonly providerId: string;
    readonly invocationId?: string;
    readonly observedReasoningEffort?: string;
    readonly disposition: PlannerStructuredDisposition;
    readonly context: MutationContext;
}
export interface RecordPlannerFailureInput {
    readonly sessionId: PlanningSessionId;
    readonly expectedRevision: number;
    readonly userTurnId: PlanningTurnId;
    readonly plannerTurnId: PlanningTurnId;
    readonly userMessage: string;
    readonly selection: PlanningInterviewerResolvedSelection;
    readonly providerId: string;
    readonly failureCategory: string;
    readonly safeMessage: string;
    readonly retryable: boolean;
    readonly context: MutationContext;
}
export declare class I2PlanningService {
    private readonly uow;
    private readonly ids;
    private readonly clock;
    private readonly lifecycle;
    constructor(uow: UnitOfWork, ids: IdGenerator, clock: Clock, lifecycle: I1LifecycleService);
    onboardProject(input: OnboardProjectInput): Promise<{
        session: PlanningSession;
        projectId: ProjectId;
        goalId: GoalId;
    }>;
    startPlanning(input: StartPlanningInput): Promise<PlanningSession>;
    get(sessionId: PlanningSessionId): Promise<PlanningSession | undefined>;
    listByProject(projectId: ProjectId): Promise<readonly PlanningSession[]>;
    private record;
    private reconcileGoalReadiness;
    private mutate;
    setPlannerOverride(sessionId: PlanningSessionId, selection: PlanningInterviewerSelection | undefined, context: MutationContext): Promise<PlanningSession>;
    applyPlannerTurn(input: ApplyPlannerTurnInput): Promise<PlanningSession>;
    recordPlannerFailure(input: RecordPlannerFailureInput): Promise<PlanningSession>;
    saveDraft(sessionId: PlanningSessionId, draft: string, _context: MutationContext): Promise<PlanningSession>;
    setMode(sessionId: PlanningSessionId, mode: PlanningParticipationMode, _context: MutationContext): Promise<PlanningSession>;
    setProfileKind(sessionId: PlanningSessionId, kind: PlanningProfileKind, _context: MutationContext): Promise<PlanningSession>;
    resolveItem(input: ResolvePlanningItemInput): Promise<PlanningSession>;
    deferItem(input: DeferPlanningItemInput): Promise<PlanningSession>;
    saveDefaults(sessionId: PlanningSessionId, _context: MutationContext): Promise<ProjectPlanningDefaults>;
    updateGoal(input: {
        readonly projectId: ProjectId;
        readonly goalId: GoalId;
        readonly title?: string;
        readonly description?: string | null;
        readonly status?: Goal["status"];
        readonly priority?: number | null | undefined;
        readonly targetDate?: string | null | undefined;
        readonly successCriteria?: readonly string[];
        readonly context: MutationContext;
    }): Promise<Goal>;
    private finalizeRevision;
    launch(input: PlanningLaunchInput): Promise<PlanningSession>;
    activateDueSchedules(contextFactory: (projectId: ProjectId) => MutationContext): Promise<number>;
}
//# sourceMappingURL=planning.d.ts.map