"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ApplicationApiImpl = void 0;
const tslib_1 = require("tslib");
const ApiBase_1 = require("./ApiBase");
const ApplicationRedux = tslib_1.__importStar(require("../../Redux/ActionsReducers/ApplicationRedux"));
class ApplicationApiImpl extends ApiBase_1.ApiBase {
    getApplicationState() {
        return this.getAdaptableState().Application;
    }
    getApplicationDataEntries() {
        return this.getApplicationState().ApplicationDataEntries;
    }
    addApplicationDataEntry(keyValuePair) {
        this.dispatchAction(ApplicationRedux.ApplicationDataEntryAdd(keyValuePair));
    }
    createApplicationDataEntry(key, value) {
        let applicationDataEntry = {
            Key: key,
            Value: value,
        };
        this.addApplicationDataEntry(applicationDataEntry);
    }
    editApplicationDataEntry(applicationDataEntry) {
        this.dispatchAction(ApplicationRedux.ApplicationDataEntryEdit(applicationDataEntry));
    }
    deleteApplicationDataEntry(applicationDataEntry) {
        this.dispatchAction(ApplicationRedux.ApplicationDataEntryDelete(applicationDataEntry));
    }
    getApplicationDataEntryByKey(key) {
        let entries = this.getApplicationState().ApplicationDataEntries;
        return entries.find((e) => e.Key === key);
    }
    getApplicationDataEntriesByValue(value) {
        let entries = this.getApplicationState().ApplicationDataEntries;
        return entries.filter((e) => e.Value === value);
    }
}
exports.ApplicationApiImpl = ApplicationApiImpl;
