import { logger } from '@/infrastructure/monitoring/logger';

export type FinalityStatus = 'PROVISIONAL' | 'FINAL' | 'IRREVERSIBLE';

/**
 * dbis.control.finality
 * Per-rail state machines and finality declaration.
 */
export class FinalityService {
	async declare(params: {
		txnId: string;
		rail: string;
		finalityStatus: FinalityStatus;
		finalityRule: string;
	}): Promise<{ status: 'DECLARED' }> {
		logger.info('FinalityService.declare', {
			txnId: params.txnId,
			rail: params.rail,
			finality: params.finalityStatus,
		});
		// Persist to gateway_finality (DAO omitted for scaffolding)
		return { status: 'DECLARED' as const };
	}
}

export const finalityService = new FinalityService();

