"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const init_or_update_property_function_1 = require("../property/init-or-update-property.function");
/**
 * Only the L(ist) dynamo datatype preservers the order of inserted items, so we have to make sure the L(ist) type is used
 * when persisting. The modelConstructor is required if the collection items
 * have some property decorators, so we can retrieve this information using the model class.
 */
function SortedSet(modelConstructor) {
    return (target, propertyKey) => {
        if (typeof propertyKey === 'string') {
            const typeInfo = {
                type: Set,
                isCustom: true,
            };
            if (modelConstructor) {
                typeInfo.genericType = modelConstructor;
            }
            init_or_update_property_function_1.initOrUpdateProperty({ isSortedCollection: true, typeInfo }, target, propertyKey);
        }
    };
}
exports.SortedSet = SortedSet;
//# sourceMappingURL=sorted-set.decorator.js.map