import { AdapterReceiveResult, AdapterSendResult, AdapterValidateResult } from './adapter-types';

export interface GatewayAdapter {
	initialize(config: Record<string, unknown>, secretsRef?: string): Promise<void>;
	health(): Promise<{ status: 'UP' | 'DOWN'; details?: Record<string, unknown> }>;
	capabilities(): Promise<string[]>;
	validate(canonicalInstruction: Record<string, unknown>): Promise<AdapterValidateResult>;
	send(outboxRecord: { txnId: string; payloadHash: string; envelope: unknown }): Promise<AdapterSendResult>;
	receive(rawRailMessage: unknown): Promise<AdapterReceiveResult>;
	mapStatus(rail: { code: string; description?: string; source?: string }): {
		status: string;
		railStatus: { code: string; description?: string; source?: string };
	};
	finalityHints(railStatus: { code: string }): { hint?: 'PROVISIONAL' | 'FINAL' | 'IRREVERSIBLE' };
	errorMap(railError: { code: string; message?: string }): {
		errorCode: string;
		retryClass: 'RETRYABLE' | 'NON_RETRYABLE' | 'MANUAL_REVIEW';
	};
}

