var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var _a;
import BaseModel from "../../Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel";
import CaptureSpan from "../Utils/Telemetry/CaptureSpan";
class LocalCache {
    static setJSON(namespace, key, value) {
        this.cache[namespace + "." + key] = value;
    }
    static setString(namespace, key, value) {
        this.cache[namespace + "." + key] = value;
    }
    static setNumber(namespace, key, value) {
        this.cache[namespace + "." + key] = value;
    }
    static setModel(namespace, key, value) {
        this.cache[namespace + "." + key] = value;
    }
    static getModel(namespace, key) {
        return this.cache[namespace + "." + key];
    }
    static getJSON(namespace, key) {
        return this.cache[namespace + "." + key];
    }
    static getString(namespace, key) {
        return this.cache[namespace + "." + key];
    }
    static getNumber(namespace, key) {
        return this.cache[namespace + "." + key];
    }
    static async getOrSetString(namespace, key, getStringFunction) {
        if (!LocalCache.getString(namespace, key)) {
            LocalCache.setString(namespace, key, await getStringFunction());
        }
        return LocalCache.getString(namespace, key);
    }
    static hasValue(namespace, key) {
        return Boolean(this.cache[namespace + "." + key]);
    }
}
LocalCache.cache = {};
export default LocalCache;
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String, Object]),
    __metadata("design:returntype", void 0)
], LocalCache, "setJSON", null);
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String, String]),
    __metadata("design:returntype", void 0)
], LocalCache, "setString", null);
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String, Number]),
    __metadata("design:returntype", void 0)
], LocalCache, "setNumber", null);
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String, BaseModel]),
    __metadata("design:returntype", void 0)
], LocalCache, "setModel", null);
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String]),
    __metadata("design:returntype", typeof (_a = typeof TBaseModel !== "undefined" && TBaseModel) === "function" ? _a : Object)
], LocalCache, "getModel", null);
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String]),
    __metadata("design:returntype", Object)
], LocalCache, "getJSON", null);
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String]),
    __metadata("design:returntype", String)
], LocalCache, "getString", null);
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String]),
    __metadata("design:returntype", Number)
], LocalCache, "getNumber", null);
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String, Function]),
    __metadata("design:returntype", Promise)
], LocalCache, "getOrSetString", null);
__decorate([
    CaptureSpan(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, String]),
    __metadata("design:returntype", Boolean)
], LocalCache, "hasValue", null);
//# sourceMappingURL=LocalCache.js.map