import { ReportStoreService } from '../reportStoreService.js';

class ProductCollectionStoreService extends ReportStoreService {
    enabled;
    constructor(reportDataStore, serviceFeatureConfig) {
        super(reportDataStore);
        this.enabled = Boolean(serviceFeatureConfig.collections);
    }
    async getSelectedProductCollectionId(userId) {
        if (!this.enabled)
            return undefined;
        const userConfig = await this.getState(userId);
        return userConfig.productCollectionInfo?.selectedProductCollection;
    }
    async setSelectedProductCollectionId(userId, id) {
        if (!this.enabled)
            return undefined;
        const userConfig = await this.getState(userId);
        return this.saveState(userId, {
            ...userConfig,
            productCollectionInfo: {
                ...userConfig.productCollectionInfo,
                selectedProductCollection: id,
            },
        });
    }
}

export { ProductCollectionStoreService };
//# sourceMappingURL=productCollectionStoreService.js.map
