'use strict';

class ReportViewerSettings {
  // #region fields
  _id;
  _storage;
  _defaults;
  // #endregion
  // #region constructor
  constructor(id, storage, defaultSettings) {
    this._id = id;
    this._storage = storage;
    this._defaults = defaultSettings || {};
  }
  // #endregion
  // #region methods
  formatKey(key) {
    return this._id + "_" + key;
  }
  getItem(key) {
    var value = this._storage.getItem(this.formatKey(key));
    if (typeof value === "string") {
      try {
        value = JSON.parse(value);
      } catch (e) {
        value = null;
      }
    }
    return value !== null && value !== void 0 ? value : this._defaults[key];
  }
  setItem(key, value) {
    var formattedKey = this.formatKey(key);
    this._storage.setItem(formattedKey, JSON.stringify(value));
  }
  // #endregion
  // #region accessors
  getViewMode() {
    return this.getItem("viewMode");
  }
  setViewMode(value) {
    this.setItem("viewMode", value);
  }
  getPageMode() {
    return this.getItem("pageMode");
  }
  setPageMode(value) {
    this.setItem("pageMode", value);
  }
  getPrintMode() {
    return this.getItem("printMode");
  }
  setPrintMode(value) {
    this.setItem("printMode", value);
  }
  getScale() {
    return this.getItem("scale");
  }
  setScale(value) {
    this.setItem("scale", value);
  }
  getScaleMode() {
    return this.getItem("scaleMode");
  }
  setScaleMode(value) {
    this.setItem("scaleMode", value);
  }
  getDocumentMapVisible() {
    return this.getItem("documentMapVisible");
  }
  setDocumentMapVisible(value) {
    this.setItem("documentMapVisible", value);
  }
  getParametersAreaVisible() {
    return this.getItem("parametersAreaVisible");
  }
  setParametersAreaVisible(value) {
    this.setItem("parametersAreaVisible", value);
  }
  getHistory() {
    return this.getItem("history");
  }
  setHistory(value) {
    this.setItem("history", value);
  }
  getClientId() {
    return this.getItem("clientId");
  }
  setClientId(value) {
    this.setItem("clientId", value);
  }
  getReportSource() {
    return this.getItem("reportSource");
  }
  setReportSource(value) {
    this.setItem("reportSource", value);
  }
  getPageNumber() {
    return this.getItem("pageNumber");
  }
  setPageNumber(value) {
    this.setItem("pageNumber", value);
  }
  getEnableAccessibility() {
    return this.getItem("enableAccessibility");
  }
  setEnableAccessibility(value) {
    this.setItem("enableAccessibility", value);
  }
  getAccessibilityKeyMap() {
    return this.getItem("accessibilityKeyMap");
  }
  setAccessibilityKeyMap(value) {
    this.setItem("accessibilityKeyMap", value);
  }
  getSearchMetadataOnDemand() {
    return this.getItem("searchMetadataOnDemand");
  }
  setSearchMetadataOnDemand(value) {
    this.setItem("searchMetadataOnDemand", value);
  }
  getKeepClientAlive() {
    return this.getItem("keepClientAlive");
  }
  setKeepClientAlive(value) {
    this.setItem("keepClientAlive", value);
  }
  // #endregion
}

exports.ReportViewerSettings = ReportViewerSettings;
