//
// Copyright © 2024 Nevis Security AG. All rights reserved.
//

import NevisMobileAuthentication

struct PendingOutOfBandOperationsMethodHandler: MethodHandler {
	func execute(using client: MobileAuthenticationClient, method: ReactMethod, with message: ChannelInMessage) async {
		let message: PendingOobOperationsMessage = validate(message: message)
		let operation = PendingOutOfBandOperation(operationId: message.operationId, method: method)
		await OperationCache.shared.put(operation, using: message.operationId)

		client.operations.pendingOutOfBandOperations
			.configure(by: message, operation: operation)
			.execute()
	}
}
