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

import Foundation

class PasswordValidationMessage: ChannelOutMessage {
	// MARK: Properties

	let password: String

	init(operationId: String, password: String) {
		self.password = password
		super.init(operationId: operationId)
	}

	// MARK: Encodable

	enum CodingKeys: String, CodingKey {
		case password
	}

	override func encode(to encoder: Encoder) throws {
		var container = encoder.container(keyedBy: CodingKeys.self)
		var passwordContainer = container.nestedUnkeyedContainer(forKey: .password)
		try Array(arrayLiteral: password).forEach { try passwordContainer.encode($0) }
		try super.encode(to: encoder)
	}
}
