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

import { InitializationError } from './InitializationError';

/**
 * An error that indicates that protected data is not available at the time of SDK initialization.
 *
 * This is an iOS specific error and indicates that the app attempted to access protected data before
 * it became available, typically because the device is locked or the app is still in the prewarming
 * phase after launch.
 * In production, encountering this error suggests the SDK was initialized too early in the app lifecycle.
 *
 * @group Errors
 * @category Initialization
 */
export class InitializationProtectedDataUnavailableError extends InitializationError {
	/**
	 * Provides details about the error that occurred.
	 */
	description: string;

	/**
	 * The exception (if any) that caused this error.
	 */
	cause?: string;

	/**
	 * The default constructor.
	 *
	 * @param description provides details about the error that occurred.
	 * @param cause the exception (if any) that caused this error.
	 */
	constructor(description: string, cause?: string) {
		super();
		this.description = description;
		this.cause = cause;
	}
}
