function _define_property(obj, key, value) {
    if (key in obj) Object.defineProperty(obj, key, {
        value: value,
        enumerable: true,
        configurable: true,
        writable: true
    });
    else obj[key] = value;
    return obj;
}
class PathHandler {
    static getInstance() {
        if (!PathHandler.instance) PathHandler.instance = new PathHandler();
        return PathHandler.instance;
    }
    parse(wildcardPath, schemaId) {
        if (!schemaId) throw new Error('schemaId is required.');
        const segments = wildcardPath.split('/').filter(Boolean);
        let found = false;
        const result = {
            schemaId
        };
        for(let i = 0; i < segments.length; i += 2){
            const key = segments[i];
            const value = segments[i + 1];
            if (!value) continue;
            let validKey = true;
            switch(key){
                case 'collection':
                    result.collection = value;
                    break;
                case 'filter-by-tk':
                    result.filterByTk = value;
                    break;
                case 'source-id':
                    result.sourceId = value;
                    break;
                case 'tab':
                    result.tab = value;
                    break;
                default:
                    validKey = false;
                    console.warn("Unknown key: ".concat(key));
            }
            if (validKey) found = true;
        }
        return !!found && result;
    }
    toWildcardPath(params) {
        const { collection, filterByTk, sourceId, tab } = params;
        const segments = [];
        if (collection) segments.push('collection', collection);
        if (filterByTk) segments.push('filter-by-tk', filterByTk);
        if (sourceId) segments.push('source-id', sourceId);
        if (tab) segments.push('tab', tab);
        return segments.join('/');
    }
    constructor(){}
}
_define_property(PathHandler, "instance", void 0);
export { PathHandler };
