
import { upcast } from '../../../base/common/types.js';

var StateType;
(function (StateType) {
    StateType["Uninitialized"] = "uninitialized";
    StateType["Idle"] = "idle";
    StateType["Disabled"] = "disabled";
    StateType["CheckingForUpdates"] = "checking for updates";
    StateType["AvailableForDownload"] = "available for download";
    StateType["Downloading"] = "downloading";
    StateType["Downloaded"] = "downloaded";
    StateType["Updating"] = "updating";
    StateType["Ready"] = "ready";
    StateType["Overwriting"] = "overwriting";
})(StateType || (StateType = {}));
var UpdateType;
(function (UpdateType) {
    UpdateType[UpdateType["Setup"] = 0] = "Setup";
    UpdateType[UpdateType["Archive"] = 1] = "Archive";
    UpdateType[UpdateType["Snap"] = 2] = "Snap";
})(UpdateType || (UpdateType = {}));
var DisablementReason;
(function (DisablementReason) {
    DisablementReason[DisablementReason["NotBuilt"] = 0] = "NotBuilt";
    DisablementReason[DisablementReason["DisabledByEnvironment"] = 1] = "DisabledByEnvironment";
    DisablementReason[DisablementReason["ManuallyDisabled"] = 2] = "ManuallyDisabled";
    DisablementReason[DisablementReason["Policy"] = 3] = "Policy";
    DisablementReason[DisablementReason["MissingConfiguration"] = 4] = "MissingConfiguration";
    DisablementReason[DisablementReason["InvalidConfiguration"] = 5] = "InvalidConfiguration";
    DisablementReason[DisablementReason["RunningAsAdmin"] = 6] = "RunningAsAdmin";
})(DisablementReason || (DisablementReason = {}));
const State = {
    Uninitialized: upcast({ type: StateType.Uninitialized }),
    Disabled: (reason) => ({ type: StateType.Disabled, reason }),
    Idle: (updateType, error, notAvailable) => ({ type: StateType.Idle, updateType, error, notAvailable }),
    CheckingForUpdates: (explicit) => ({ type: StateType.CheckingForUpdates, explicit }),
    AvailableForDownload: (update, canInstall) => ({ type: StateType.AvailableForDownload, update, canInstall }),
    Downloading: (update, explicit, overwrite, downloadedBytes, totalBytes, startTime) => ({ type: StateType.Downloading, update, explicit, overwrite, downloadedBytes, totalBytes, startTime }),
    Downloaded: (update, explicit, overwrite) => ({ type: StateType.Downloaded, update, explicit, overwrite }),
    Updating: (update, currentProgress, maxProgress) => ({ type: StateType.Updating, update, currentProgress, maxProgress }),
    Ready: (update, explicit, overwrite) => ({ type: StateType.Ready, update, explicit, overwrite }),
    Overwriting: (update, explicit) => ({ type: StateType.Overwriting, update, explicit }),
};

export { DisablementReason, State, StateType, UpdateType };
