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

import NevisMobileAuthentication

struct PasswordEnrollMethodHandler: UserInteractionMethodHandler {
	func execute(using _: MobileAuthenticationClient, method: ReactMethod, with message: ChannelInMessage, operation: any UserInteractionOperation) async {
		let message: PasswordEnrollMessage = validate(message: message)
		let state: PasswordEnrollState = await validate(state: operation.state)
		await state.enroll(password: message.password.joined())
		MethodChannelHandler.shared.resolve(method: method)
	}
}
