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

import NevisMobileAuthentication

final class AccountSelectorImpl: Sendable {
	// MARK: Properties

	let operationId: String

	// MARK: Initialization

	init(operationId: String) {
		self.operationId = operationId
	}
}

// MARK: - AccountSelector

extension AccountSelectorImpl: AccountSelector {
	func selectAccount(context: AccountSelectionContext, handler: AccountSelectionHandler) {
		Task {
			let state = SelectAccountState(context: context, handler: handler)
			let message = AccountSelectorMessage(operationId: operationId,
			                                     context: context)
			await selectAccount(operationId: operationId, message: message, userInteractionState: state)
		}
	}
}
