import { isAppStorageInfo } from "@ledgerhq/device-core";
import { createCustomErrorClass } from "@ledgerhq/errors";
export function isAppStorageType(data) {
    return (typeof data === "object" &&
        data !== null &&
        "appDataInfo" in data &&
        isAppStorageInfo(data.appDataInfo) &&
        "appData" in data &&
        typeof data.appData === "string");
}
export var BackupAppDataEventType;
(function (BackupAppDataEventType) {
    /**
     * The progress of the ongoing backup process.
     */
    BackupAppDataEventType["Progress"] = "progress";
    /**
     * The application data information has been fetched.
     */
    BackupAppDataEventType["AppDataInfoFetched"] = "appDataInfoFetched";
    /**
     * The application data has been backed up.
     */
    BackupAppDataEventType["AppDataBackedUp"] = "appDataBackedUp";
    /**
     * The application data has already been backed up, no need to backup again.
     */
    BackupAppDataEventType["AppDataAlreadyBackedUp"] = "appDataAlreadyBackedUp";
    /**
     * There is no application data to backup.
     */
    BackupAppDataEventType["NoAppDataToBackup"] = "noAppDataToBackup";
})(BackupAppDataEventType || (BackupAppDataEventType = {}));
/**
 * An error that occurs during the backup process, the error message should be descriptive when thrown.
 */
export const BackupAppDataError = createCustomErrorClass("BackupAppDataError");
export var RestoreAppDataEventType;
(function (RestoreAppDataEventType) {
    /**
     * The progress of the ongoing restoring process.
     */
    RestoreAppDataEventType["Progress"] = "progress";
    /**
     * The application data is initialized for the restore process.
     */
    RestoreAppDataEventType["AppDataInitialized"] = "appDataInitialized";
    /**
     * The application data has been restored.
     */
    RestoreAppDataEventType["AppDataRestored"] = "appDataRestored";
    /**
     * There is no application data to restore.
     */
    RestoreAppDataEventType["NoAppDataToRestore"] = "noAppDataToRestore";
    /**
     * The user refused to restore the application data.
     */
    RestoreAppDataEventType["UserRefused"] = "userRefused";
})(RestoreAppDataEventType || (RestoreAppDataEventType = {}));
/**
 * An error that occurs during the restore process, the error message should be descriptive when thrown.
 */
export const RestoreAppDataError = createCustomErrorClass("RestoreAppDataError");
export var DeleteAppDataEventType;
(function (DeleteAppDataEventType) {
    DeleteAppDataEventType["AppDataDeleteStarted"] = "appDataDeleteStarted";
    /**
     * The application data has been deleted.
     */
    DeleteAppDataEventType["AppDataDeleted"] = "appDataDeleted";
    /**
     * There is no application data to delete.
     */
    DeleteAppDataEventType["NoAppDataToDelete"] = "noAppDataToDelete";
})(DeleteAppDataEventType || (DeleteAppDataEventType = {}));
/**
 * An error that occurs during the delete process (local data), the error message should be descriptive when thrown.
 */
export const DeleteAppDataError = createCustomErrorClass("DeleteAppDataError");
//# sourceMappingURL=types.js.map