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

import NevisMobileAuthentication

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

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