"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const snconfigbehavior_1 = require("./snconfigbehavior");
class SnConfigFieldModelStore {
static Add(newModel) {
if (!newModel.StoreKey) {
throw Error('No Store key defined');
}
if (this.Contains(newModel.StoreKey)) {
throw new Error(`Field ${newModel.StoreKey} for configuration model already in the store!`);
}
this.store[newModel.StoreKey] = newModel;
}
static Get(storeKey) {
const found = this.store[storeKey];
if (!found) {
throw new Error(`No entry found with the field name '${storeKey}'`);
}
return this.store[storeKey];
}
static Contains(fieldName) {
const found = this.store[fieldName];
return found !== undefined;
}
static GetCommandOptions() {
const items = [];
for (const field in this.store) {
if (field && (this.store[field].Behavior & snconfigbehavior_1.SnConfigBehavior.AllowFromCommandLine) === snconfigbehavior_1.SnConfigBehavior.AllowFromCommandLine) {
items.push(this.store[field]);
}
}
return items;
}
}
SnConfigFieldModelStore.store = [];
exports.SnConfigFieldModelStore = SnConfigFieldModelStore;
//# sourceMappingURL=snconfigfieldmodelstore.js.map |