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

import { DeviceInformationSyncError } from './DeviceInformationSyncError';
import { Server } from '../../../localData/Server';

/**
 * The clocks on the mobile and on the server are too apart and the server refused to validate the
 * {@link https://datatracker.ietf.org/doc/html/rfc7515 | JWS}.
 *
 * You can ask the user to verify that the device clock is correctly set.
 *
 * @group Errors
 * @category Device Information Sync
 */
export class DeviceInformationSyncClockSkewTooBigError extends DeviceInformationSyncError {
	/**
	 * The server where the error occurred.
	 */
	server: Server;

	/**
	 * Provides details about the error that occurred.
	 */
	description: string;

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

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