import { type ComputedRef, type Ref } from "vue";
import type { FdoCustomAttribute } from "@feedmepos/core/entity";
import { type MongoQuery, FdoRuleGroup } from "@feedmepos/custom-attributes";
type CustomAttribute = Record<string, any> | null | undefined;
/**
 * Custom attributes composable for handling filtering and querying based on custom attributes
 *
 * This composable processes custom attributes from a data source and provides filtering capabilities
 * using both user-friendly rule formats and MongoDB query formats.
 *
 * @param options - Configuration object
 * @param options.valueSource - Reactive array of items that contain custom attributes
 * @param options.keySource - Optional reactive array of FdoCustomAttribute definitions to constrain available keys
 * @param options.entity - Entity type for the custom attributes ("restaurant", "item", or "group")
 * @param options.mapper - Function to extract custom attributes from each item (defaults to accessing .customAttributes)
 *
 * @returns Object containing:
 * - attributes: Computed array of available custom attribute keys with their possible values
 * - filterRule: Reactive rule object for user-friendly filtering
 * - mongoQuery: Reactive MongoDB query object derived from filterRule
 *
 * @example
 * ```typescript
 * const { attributes, filterRule, mongoQuery } = useCustomAttributes({
 *   valueSource: ref([{ customAttributes: { type: 'ADDON', category: 'drinks' } }]),
 *   entity: 'item'
 * })
 *
 * // Set a filter rule
 * filterRule.value = {
 *   logic: 'AND',
 *   rules: [{ property: 'type', operator: '$in', value: ['ADDON'], type: 'string' }]
 * }
 *
 * // mongoQuery will automatically update to:
 * { $and: [{ type: { $in: ['ADDON'] } }] }
 * ```
 */
export declare function useCustomAttributes({ valueSource, keySource, entity, mapper }: {
    valueSource: Ref<any[]> | ComputedRef<any[]>;
    keySource?: Ref<FdoCustomAttribute[]> | ComputedRef<FdoCustomAttribute[]>;
    entity?: "restaurant" | "item" | "group";
    mapper?: (item: any) => CustomAttribute;
}): {
    attributes: ComputedRef<{
        type: "string";
        key: string;
        entity: any;
        values: string[];
    }[]>;
    filterRule: Ref<{
        value: string | number | boolean | (string | number | boolean)[];
        type: "string" | "number" | "date";
        operator: "$eq" | "$gt" | "$lt" | "$ne" | "$gte" | "$lte" | "$in" | "$nin" | "$regex" | "$contains" | "$startsWith" | "$endsWith" | "$between";
        property: string;
    } | {
        logic: "AND" | "OR";
        rules: (any | {
            value: string | number | boolean | (string | number | boolean)[];
            type: "string" | "number" | "date";
            operator: "$eq" | "$gt" | "$lt" | "$ne" | "$gte" | "$lte" | "$in" | "$nin" | "$regex" | "$contains" | "$startsWith" | "$endsWith" | "$between";
            property: string;
        })[];
    }, {
        value: string | number | boolean | (string | number | boolean)[];
        type: "string" | "number" | "date";
        operator: "$eq" | "$gt" | "$lt" | "$ne" | "$gte" | "$lte" | "$in" | "$nin" | "$regex" | "$contains" | "$startsWith" | "$endsWith" | "$between";
        property: string;
    } | FdoRuleGroup | {
        value: string | number | boolean | (string | number | boolean)[];
        type: "string" | "number" | "date";
        operator: "$eq" | "$gt" | "$lt" | "$ne" | "$gte" | "$lte" | "$in" | "$nin" | "$regex" | "$contains" | "$startsWith" | "$endsWith" | "$between";
        property: string;
    } | {
        logic: "AND" | "OR";
        rules: (any | {
            value: string | number | boolean | (string | number | boolean)[];
            type: "string" | "number" | "date";
            operator: "$eq" | "$gt" | "$lt" | "$ne" | "$gte" | "$lte" | "$in" | "$nin" | "$regex" | "$contains" | "$startsWith" | "$endsWith" | "$between";
            property: string;
        })[];
    }>;
    mongoQuery: Ref<{
        [x: string]: any;
    } | {
        [x: string]: any;
        $and: ({
            [x: string]: any;
        } | any | {
            [x: string]: any;
            $or: ({
                [x: string]: any;
            } | any | any)[];
        })[];
    } | {
        [x: string]: any;
        $or: ({
            [x: string]: any;
        } | any | any)[];
    }, MongoQuery<any> | {
        [x: string]: any;
        $and: ({
            [x: string]: any;
        } | any | {
            [x: string]: any;
            $or: ({
                [x: string]: any;
            } | any | any)[];
        })[];
    } | {
        [x: string]: any;
        $or: ({
            [x: string]: any;
        } | any | any)[];
    }>;
};
export declare const EMPTY_MONGO_QUERY: {
    $and: never[];
};
export declare const EMPTY_RULE: FdoRuleGroup;
/**
 * Checks if a MongoDB query object represents an empty/unfiltered state
 *
 * @param query - The MongoDB query object to check
 * @returns true if the query is empty or equivalent to no filtering
 */
export declare function isEmptyMongoQuery(query: MongoQuery<any>): boolean;
/**
 * Checks if a rule object represents an empty/unfiltered state
 *
 * @param rule - The rule object to check
 * @returns true if the rule is empty or equivalent to no filtering
 */
export declare function isEmptyRule(rule: any): boolean;
export {};
//# sourceMappingURL=customAttributes.d.ts.map