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

import { OperationMessage } from './OperationMessage';

/**
 * Holds the parameters of the password change operation call.
 */
export class PasswordChangeMessage extends OperationMessage {
	/**
	 * The identifier of the operation.
	 */
	operationId: string;

	/**
	 * Flag that tells whether the password changer is provided.
	 */
	passwordChangerProvided: boolean;

	/**
	 * The username.
	 */
	username?: string;

	/**
	 * Flag that tells whether the success callback is provided.
	 */
	onSuccessProvided: boolean;

	/**
	 * Flag that tells whether the error callback is provided.
	 */
	onErrorProvided: boolean;

	/**
	 * Default constructor for {@link PasswordChangeMessage}.
	 *
	 * @param operationId the identifier of the operation.
	 * @param passwordChangerProvided: flag that tells whether the password changer is provided.
	 * @param onSuccessProvided: flag that tells whether the success callback is provided.
	 * @param onErrorProvided: flag that tells whether the error callback is provided.
	 * @param username: the username.
	 */
	constructor(
		operationId: string,
		passwordChangerProvided: boolean,
		onSuccessProvided: boolean,
		onErrorProvided: boolean,
		username?: string
	) {
		super();
		this.operationId = operationId;
		this.username = username;
		this.passwordChangerProvided = passwordChangerProvided;
		this.onSuccessProvided = onSuccessProvided;
		this.onErrorProvided = onErrorProvided;
	}
}
