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

import NevisMobileAuthentication

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