"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const mapper_1 = require("../mapper");
function objectFromDb(val, propertyMetadata) {
    if (propertyMetadata && propertyMetadata.typeInfo && propertyMetadata.typeInfo.isCustom) {
        return mapper_1.fromDb(val.M, propertyMetadata.typeInfo.type);
    }
    else {
        return mapper_1.fromDb(val.M);
    }
}
function objectToDb(modelValue, propertyMetadata) {
    let value;
    if (propertyMetadata && propertyMetadata.typeInfo && propertyMetadata.typeInfo.isCustom) {
        value = mapper_1.toDb(modelValue, propertyMetadata.typeInfo.type);
    }
    else {
        value = mapper_1.toDb(modelValue);
    }
    return { M: value };
}
exports.ObjectMapper = {
    fromDb: objectFromDb,
    toDb: objectToDb,
};
//# sourceMappingURL=object.mapper.js.map