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

import NevisMobileAuthentication

final class OnResultImpl: Sendable {
	// MARK: Properties

	let operationId: String
	let method: ReactMethod

	// MARK: Initialization

	init(operationId: String, method: ReactMethod) {
		self.operationId = operationId
		self.method = method
	}
}

// MARK: - Public Interface

extension OnResultImpl {
	func onResult(message: any OnResultMessage) {
		Task {
			MethodChannelHandler.shared.resolve(method: method, message: message)
			await OperationCache.shared.delete(by: operationId)
		}
	}
}
