/*!
 * @license
 * Copyright © 2005-2025 Hyland Software, Inc. and its affiliates. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
import { BehaviorSubject, Observable, ReplaySubject, Subject } from 'rxjs';
import { AppConfigService } from '@alfresco/adf-core';
import { RequestFacetFields, RequestHighlight, RequestScope, RequestSortDefinitionInner, ResultSetPaging, SearchApi, SearchRequest } from '@alfresco/js-api';
import { SearchCategory } from '../models/search-category.interface';
import { FilterQuery } from '../models/filter-query.interface';
import { SearchRange } from '../models/search-range.interface';
import { SearchConfiguration } from '../models/search-configuration.interface';
import { FacetQuery } from '../models/facet-query.interface';
import { SearchSortingDefinition } from '../models/search-sorting-definition.interface';
import { FacetField } from '../models/facet-field.interface';
import { FacetFieldBucket } from '../models/facet-field-bucket.interface';
import { SearchForm } from '../models/search-form.interface';
import { AlfrescoApiService } from '../../services/alfresco-api.service';
export declare abstract class BaseQueryBuilderService {
    protected readonly appConfig: AppConfigService;
    protected readonly alfrescoApiService: AlfrescoApiService;
    private readonly router;
    private readonly activatedRoute;
    private _searchApi;
    get searchApi(): SearchApi;
    configUpdated: Subject<SearchConfiguration>;
    filterLoaded: Subject<void>;
    updated: Subject<SearchRequest>;
    executed: Subject<ResultSetPaging>;
    error: Subject<unknown>;
    searchForms: ReplaySubject<SearchForm[]>;
    filterQueryUpdate: Subject<void>;
    populateFilters: BehaviorSubject<{
        [key: string]: any;
    }>;
    categories: SearchCategory[];
    queryFragments: {
        [id: string]: string;
    };
    filterQueries: FilterQuery[];
    filterRawParams: {
        [key: string]: any;
    };
    paging: {
        maxItems?: number;
        skipCount?: number;
    };
    sorting: SearchSortingDefinition[];
    sortingOptions: SearchSortingDefinition[];
    private encodedQuery;
    private scope;
    private selectedConfiguration;
    private _userQuery;
    protected userFacetBuckets: {
        [key: string]: FacetFieldBucket[];
    };
    get userQuery(): string;
    set userQuery(value: string);
    config: SearchConfiguration;
    ranges: {
        [id: string]: SearchRange;
    };
    protected constructor(appConfig: AppConfigService, alfrescoApiService: AlfrescoApiService);
    abstract loadConfiguration(): SearchConfiguration | SearchConfiguration[];
    abstract isFilterServiceActive(): boolean;
    resetToDefaults(withNavigate?: boolean): void;
    getDefaultConfiguration(): SearchConfiguration | undefined;
    updateSelectedConfiguration(index: number): void;
    private resetSearchOptions;
    getSearchFormDetails(): SearchForm[];
    private setUpSearchConfiguration;
    /**
     * Adds a facet bucket to a field.
     *
     * @param field The target field
     * @param bucket Bucket to add
     */
    addUserFacetBucket(field: string, bucket: FacetFieldBucket): void;
    /**
     * Gets the buckets currently added to a field
     *
     * @param field The target fields
     * @returns Bucket array
     */
    getUserFacetBuckets(field: string): FacetFieldBucket[];
    /**
     * Removes an existing bucket from a field.
     *
     * @param field The target field
     * @param bucket Bucket to remove
     */
    removeUserFacetBucket(field: string, bucket: FacetFieldBucket): void;
    /**
     * Adds a filter query to the current query.
     *
     * @param query Query string to add
     */
    addFilterQuery(query: string): void;
    /**
     * Removes an existing filter query.
     *
     * @param query The query to remove
     */
    removeFilterQuery(query: string): void;
    /**
     * Gets a facet query by label.
     *
     * @param label Label of the query
     * @returns Facet query data
     */
    getFacetQuery(label: string): FacetQuery;
    /**
     * Gets a facet field by label.
     *
     * @param label Label of the facet field
     * @returns Facet field data
     */
    getFacetField(label: string): FacetField;
    setScope(scope: RequestScope): void;
    getScope(): RequestScope;
    /**
     * Builds the current query and triggers the `updated` event.
     *
     * @param queryBody query settings
     */
    update(queryBody?: SearchRequest): void;
    /**
     * Builds and executes the current query.
     *
     * @param updateQueryParams whether query params should be updated with encoded query
     * @param queryBody query settings
     */
    execute(updateQueryParams?: boolean, queryBody?: SearchRequest): Promise<void>;
    search(queryBody: SearchRequest): Observable<ResultSetPaging>;
    /**
     * Builds the current query.
     *
     * @returns The finished query
     */
    buildQuery(): SearchRequest;
    /**
     * Gets the primary sorting definition.
     *
     * @returns The primary sorting definition
     */
    getPrimarySorting(): SearchSortingDefinition;
    /**
     * Gets all pre-configured sorting options that users can choose from.
     *
     * @returns Pre-configured sorting options
     */
    getSortingOptions(): SearchSortingDefinition[];
    /**
     * Gets the query group.
     *
     * @param query Target query
     * @returns Query group
     */
    getQueryGroup(query: FacetQuery): string;
    /**
     * Checks if FacetQueries has been defined
     *
     * @returns True if defined, false otherwise
     */
    get hasFacetQueries(): boolean;
    /**
     * Checks if FacetIntervals has been defined
     *
     * @returns True if defined, false otherwise
     */
    get hasFacetIntervals(): boolean;
    get hasFacetHighlight(): boolean;
    protected get sort(): RequestSortDefinitionInner[];
    protected get facetQueries(): FacetQuery[];
    protected get facetIntervals(): any;
    protected get highlight(): RequestHighlight;
    protected getFinalQuery(): string;
    protected get facetFields(): RequestFacetFields;
    /**
     * Encloses a label name with double quotes if it contains whitespace characters.
     *
     * @param configLabel Original label text
     * @returns Label, possibly with quotes if it contains spaces
     */
    getSupportedLabel(configLabel: string): string;
    /**
     * Encodes filter configuration stored in filterRawParams object.
     */
    encodeQuery(): void;
    /**
     * Encodes existing filters configuration and updates search query param value.
     */
    updateSearchQueryParams(): void;
    /**
     * Builds search query with provided user query, executes query, encodes latest filter config and navigates to search.
     *
     * @param query user query to search for
     * @param searchUrl search url to navigate to
     */
    navigateToSearch(query: string, searchUrl: string): Promise<void>;
}
