"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RopidVYMIMetadataModel = exports.DatasetEnum = void 0;
const helpers_1 = require("@golemio/core/dist/integration-engine/helpers");
const shared_1 = require("../../shared");
const ropid_vymi_1 = require("../../../schema-definitions/ropid-vymi");
var DatasetEnum;
(function (DatasetEnum) {
    DatasetEnum["EVENTS"] = "EVENTS";
})(DatasetEnum || (exports.DatasetEnum = DatasetEnum = {}));
class RopidVYMIMetadataModel extends shared_1.RopidMetadataModel {
    constructor() {
        super(ropid_vymi_1.RopidVYMI);
        this.getDigest = async (dataset) => {
            try {
                const result = await this.sequelizeModel.findOne({
                    order: [["version", "DESC"]],
                    where: {
                        dataset,
                        key: shared_1.MetaDatasetInfoKeyEnum.DIGEST,
                        type: shared_1.MetaTypeEnum.DATASET_INFO,
                    },
                });
                return result?.dataValues?.value || null;
            }
            catch (err) {
                helpers_1.log.warn(err);
                return null;
            }
        };
    }
}
exports.RopidVYMIMetadataModel = RopidVYMIMetadataModel;
//# sourceMappingURL=RopidVYMIMetadataModel.js.map