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

import NevisMobileAuthentication

struct PasswordValidatedForEnrollmentMethodHandler: UserInteractionMethodHandler {
	func execute(using _: MobileAuthenticationClient, method: ReactMethod, with message: ChannelInMessage, operation: any UserInteractionOperation) async {
		let message: PasswordValidatedForEnrollmentMessage = validate(message: message)
		let state: PasswordValidateForEnrollmentState = await validate(state: operation.state)
		await state.validatePassword(errorMessage: message.errorMessage, cause: message.cause)
		MethodChannelHandler.shared.resolve(method: method)
	}
}
