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

import NevisMobileAuthentication

struct AuthenticationMethodHandler: MethodHandler {
	func execute(using client: MobileAuthenticationClient, with message: ChannelInMessage) {
		let message: AuthenticationMessage = validate(message: message)
		let operation = AuthenticationOperation(operationId: message.operationId, method: .authenticate)
		OperationCache.shared.put(operation, using: message.operationId)

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