import React from 'react';
import { DebouncedFunc } from 'lodash';
import { DynamicScore, EventLabel, Property, PropertyMap, Segment, SegmentType, Signal, SignalType, User } from '@parlor/common/amplify-schema';
import { Admin, CvuCalculationTemplate } from './../../common/amplify-schema/API';
import { IGetConfigParams } from './components/filter-buttons/interfaces';
import { FilterFor, ICustomObject, Variations, cvuNumberOptions, numberSignalOptions, propertyEventOptions, signalTimeConstraintOptions, timeframeOptions } from './components/utils';
export type QueryData = {
    id: string;
    isChecked?: boolean;
    isChild: boolean;
    isDefault?: boolean;
    value: {
        id: string;
        text: string;
        values: {
            comparedToOption?: (typeof numberSignalOptions)[0];
            eventType?: (typeof propertyEventOptions)[0];
            numberTypeOption?: (typeof cvuNumberOptions)[0];
            primaryOperator?: {
                id: string;
                text: string;
            };
            primaryValue?: any;
            property?: Partial<PropertyMap>;
            secondaryOperator?: {
                id: string;
                text: string;
            };
            secondaryValue?: any;
            signalTimeConstraint?: (typeof signalTimeConstraintOptions)[0];
            timeframeOption?: (typeof timeframeOptions)[0];
            timeframeValue?: any;
        };
    };
};
export type DataProps = {
    customObject?: ICustomObject;
    data: QueryData[];
    filterFor: FilterFor | null;
    id: string;
}[];
export type QueryBuilderResults = {
    filters: {
        operator: any;
        property: any;
        propertyType: any;
        values: string | number | any[];
    }[];
    type: FilterFor;
};
export type QueryBuilderParentProps = {
    /**
     * what to do when plus icon is clicked
     */
    addNewRowData?: QueryData['value'];
    /**
     * autoSubmit results on value change
     */
    autoSubmit?: boolean;
    /**
     * builder box classes
     */
    builderBoxClasses?: string;
    /**
     * classes for base form element
     */
    classes?: string | null;
    /**
     * handleResults takes the values object and does something with it. The results will be in the following format
     */
    handleResults?: (data: any) => void;
    /**
     * initialData: Initial data incase editing Segment or Signal that comes from queryLiteral Property.
     */
    initialData?: DataProps[];
    /**
     * isDefault tells us if it a Al Users or All Accounts Query.
     */
    isDefault?: boolean;
    /**
     * isDefinition means that this is a static representation of the existing segment, you must pass
     * initial Data for this to work.
     */
    isDefinition?: boolean;
    /**
     * isRemoveDefaults means you can't select All Accounts, ALl Users, etc.
     */
    isRemoveDefaults?: boolean;
    /**
     * isShowCertainInputs allows you to hide a list of inputs.
     */
    isShowCertainInputs?: IGetConfigParams;
    /**
     * isTooltip means that this is a static representation of the existing segment, you must pass
     * initial Data for this to work.
     */
    isTooltip?: boolean;
    /**Returns and array of cvu templates for cvu selector
     *
     */
    loadCvuCalculationTemplates?: (options?: {
        nextToken?: string;
        searchTerm?: string;
    }) => Promise<{
        data: CvuCalculationTemplate[];
        nextToken?: string | null;
    }>;
    /**
     * function that returns an array of segments.
     * Should be in the following format:
     */
    loadDynamicScores?: (options?: {
        nextToken?: string;
        searchTerm?: string;
    }) => Promise<{
        data: DynamicScore[];
        nextToken?: string | null;
    }>;
    /**
     * select loader that loads events for Select Components
     * Should be in the following format:
     */
    loadEvents?: (options?: {
        nextToken?: string;
        searchTerm?: string;
    }) => Promise<{
        data: EventLabel[];
        nextToken?: string | null;
    }>;
    /**
     * function that returns an array of DISTINCTproperties from the users or accounts. This should get both
     * Should be in the following format:
     */
    loadProperties?: (options?: {
        parlorKey: string;
        searchTerm?: string;
        skip?: number;
        take?: number;
    }) => Promise<{
        count?: number | null;
        returnedProperties: Property[] | Admin[];
    }>;
    /**
     * Loader for Property Maps to display in Select
     * Should be in the following format:
     */
    loadPropertyMap?: (options?: {
        customObjectName?: string;
        key?: string;
        nextToken?: string | number;
        searchTerm?: string;
    }) => Promise<{
        data: PropertyMap[];
        nextToken?: string | null;
        totalCount?: number;
    }>;
    /**
     * function that returns an array of segments.
     * Should be in the following format:
     */
    loadSegments?: (options?: {
        nextToken?: string;
        searchTerm?: string;
        type?: SegmentType;
    }) => Promise<{
        data: Segment[];
        nextToken?: string | null;
    }>;
    /**
     * function that returns an array of signals.
     * Should be in the following format:
     */
    loadSignals?: (options?: {
        nextToken?: string;
        searchTerm?: string;
    }) => Promise<{
        data: Signal[];
        nextToken?: string | null;
    }>;
    /**
     * internal state passed from parent component
     * use this if you want to control the state of the query builder
     *
     * NOTE: should be used in combination with setQueryData
     */
    queryData?: DataProps[];
    /**
     * Type of Segment.
     */
    segmentType: SegmentType | 'mixed';
    /**
    Sets whether or not default item is select4d.
     */
    setIsDefault?: React.Dispatch<React.SetStateAction<boolean>>;
    /**
     * updater function for internal state passed from parent component
     * use this if you want to control the state of the query builder
     *
     * NOTE: should be used in combination with queryData
     */
    setQueryData?: React.Dispatch<React.SetStateAction<DataProps[]>>;
    /**
     * whether to show the title or not:
     */
    showTitle: boolean;
    /**
     * Type of Signal
     */
    signalType?: SignalType | null;
    /**
     * title to show at start of qb
     */
    startTitle?: string;
    /**
     * outside form
     */
    useOutsideForm?: boolean;
    /**
     * type of selector to show.
     */
    variant: Variations;
    /**
     * Hide the add group button.
     */
    withGroup?: boolean;
    /**
     * Hide submit button.
     */
    withSubmit?: boolean;
    /**
     * Show sticky item like "Any Event" at top of search bar
     */
    showStickyItem?: boolean;
};
export type QueryBuilderProps = {
    /**
     * autoSubmit when a value is completed
     */
    autoSubmit?: boolean;
    /**
     * handle when the filterFor button is changed
     */
    handleFilterForChange: (filterFor: FilterFor, idx: string, customObject?: ICustomObject) => void;
    /**
     * Idx for managing data of all components
     */
    id: string;
    /**
     * Boolean that changes ListItems if Base or Not
     */
    isBase?: boolean;
    /**
     * Whether default row or not
     */
    isDefault?: boolean;
    /**
     * Whether or not it is a Definition Only.
     */
    isDefinition?: boolean;
    /**
     * isRemoveDefaults means you can't select All Accounts, ALl Users, etc.
     */
    isRemoveDefaults?: boolean;
    /**
     * isShowCertainInputs allows you to hide a list of inputs.
     */
    isShowCertainInputs?: IGetConfigParams;
    /**
     * Whether or not it is a Tooltip Only.
     */
    isTooltip?: boolean;
    /**
     * whether is default component or not
     */
    setIsDefault?: React.Dispatch<React.SetStateAction<boolean>>;
    /**
     * whether to show the title or not:
     */
    showTitle: boolean;
    /**
     * title to show at start of qb
     */
    startTitle?: string;
    /**
     * type of selector to show.
     */
    variant: Variations;
    /**
     * boolean on whether or not to show Any Event
     */
    showStickyItem?: boolean;
};
type QueryContextTypes = {
    addNewRowData?: QueryData['value'];
    autoSubmit: boolean;
    data: DataProps;
    handleSubmit: DebouncedFunc<() => void>;
    isTooltip: boolean;
    loadCvuCalculationTemplates?: (options?: {
        nextToken?: string;
        searchTerm?: string;
    }) => Promise<{
        data: CvuCalculationTemplate[];
        nextToken?: string | null;
    }>;
    loadDynamicScores?: (options?: {
        nextToken?: string;
        searchTerm?: string;
    }) => Promise<{
        data: DynamicScore[];
        nextToken?: string | null;
    }>;
    loadEvents?: (options?: {
        nextToken?: string;
        searchTerm?: string;
    }) => Promise<{
        data: EventLabel[];
        nextToken?: string | null;
    }>;
    loadProperties?: (options?: {
        parlorKey: string;
        searchTerm?: string;
        skip?: number;
        take?: number;
    }) => Promise<{
        count?: number;
        returnedProperties: Property[] | Admin[];
    }>;
    loadPropertyMap?: (options?: {
        customObjectName?: string;
        key?: string;
        nextToken?: string | number;
        searchTerm?: string;
    }) => Promise<{
        data: PropertyMap[];
        nextToken?: string | null;
        totalCount?: number;
    }>;
    loadSegments?: (options?: {
        nextToken?: string;
        searchTerm?: string;
        type?: SegmentType;
    }) => Promise<{
        data: Segment[];
        nextToken?: string | null;
    }>;
    loadSignals?: (options?: {
        nextToken?: string;
        searchTerm?: string;
    }) => Promise<{
        data: Signal[];
        nextToken?: string | null;
    }>;
    loadUsers?: (searchTerm: string) => Promise<User[]>;
    removeGroup: () => void;
    segmentType: SegmentType | 'mixed';
    setData: (values: DataProps) => void;
    setHasError: React.Dispatch<React.SetStateAction<boolean>>;
    variant: Variations;
};
export declare const QueryContext: React.Context<QueryContextTypes>;
export {};
