import type { Opportunity, OpportunityActor, OpportunityGraphDatabase } from '../../shared/interfaces/database.interface.js'; /** The mutation result shape returned by opportunity lifecycle graph nodes. */ export interface OpportunityMutationResult { success: boolean; message?: string; opportunityId?: string; notified?: string[]; conversationId?: string; error?: string; } /** Narrow persistence boundary for user-driven opportunity lifecycle actions. */ export type OpportunityLifecyclePort = Pick; /** Host callback used to notify an actor after an opportunity becomes visible to them. */ export type QueueOpportunityNotificationFn = (opportunityId: string, recipientId: string, priority: 'immediate' | 'high' | 'low') => Promise; type StatusTransitionPlan = { kind: 'stamp_accepted'; counterpartUserId?: string; } | { kind: 'set_terminal_status'; status: 'rejected' | 'expired'; }; type SendOpportunityPlan = { sender: OpportunityActor; recipients: OpportunityActor[]; }; /** * Applies status-transition admission rules before lifecycle persistence. * Acceptance is a two-party action: an actor that already acted cannot accept * again, while rejection and expiry remain available to any participating actor. */ export declare function assessOpportunityStatusTransition(opportunity: Opportunity, actorUserId: string, newStatus: string | undefined): StatusTransitionPlan | OpportunityMutationResult; /** * Applies send admission and recipient-routing rules without performing writes. * Introducers, peers, and direct patient/party flows each reveal the next tier * to a distinct audience. */ export declare function assessOpportunitySend(opportunity: Opportunity, actorUserId: string): SendOpportunityPlan | OpportunityMutationResult; /** Checks whether a caller may approve this opportunity's introducer gate. */ export declare function assessIntroductionApproval(opportunity: Opportunity, actorUserId: string): OpportunityMutationResult | { kind: 'approve'; }; /** Persists an admitted status transition, preserving accept-before-write DM ordering. */ export declare function updateOpportunityLifecycle(database: OpportunityLifecyclePort, input: { opportunityId?: string; actorUserId: string; newStatus?: string; }): Promise; /** Expires an opportunity after verifying the caller is one of its actors. */ export declare function deleteOpportunityLifecycle(database: OpportunityLifecyclePort, input: { opportunityId?: string; actorUserId: string; }): Promise; /** Persists a send transition, then notifies only the actors exposed by its routing policy. */ export declare function sendOpportunityLifecycle(database: OpportunityLifecyclePort, input: { opportunityId?: string; actorUserId: string; }, queueNotification?: QueueOpportunityNotificationFn): Promise; /** Approves an introducer gate before enqueuing the existing-opportunity negotiation. */ export declare function approveOpportunityIntroduction(database: OpportunityLifecyclePort, input: { opportunityId?: string; actorUserId: string; }, queueNegotiateExisting?: (opportunityId: string, userId: string) => Promise): Promise; export {};