import { InquiryType } from '../enums/inquiry-type.enum'; import { ProviderName } from '../enums/provider-name.enum'; import { AttemptTrail } from '../helpers/provider-resilience.helper'; import type { OutboundRequestTrace } from '../helpers/http-client.helper'; /** * Contract every external provider adapter must fulfill. * Keeps orchestration logic decoupled from provider implementations (Strategy pattern). */ export interface InquiryProvider { readonly name: ProviderName; readonly supportedInquiryTypes: InquiryType[]; isEnabled(): boolean; execute( inquiryType: InquiryType, payload: TRequest, context: ProviderExecutionContext, ): Promise; } export interface ProviderExecutionContext { requestId: string; trackingCode: string; /** Absolute timestamp when the inquiry wall-clock budget expires. */ deadlineAt?: number; /** Signal for cancelling the currently active provider attempt. */ signal?: AbortSignal; /** Mutable trail of HTTP attempts for client summary + logs. */ attemptTrail?: AttemptTrail; /** Sanitized outbound HTTP calls made during this inquiry, including retries. */ outboundRequests?: OutboundRequestTrace[]; }