/**
 * Copyright (c) 2020-present, Goldman Sachs
 *
 * 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 { type TooltipPlacement, type SelectComponent } from '@finos/legend-art';
import { type Enum, type ObserverContext, type PureModel, type ValueSpecification, Type, VariableExpression, V1_PackageableType } from '@finos/legend-graph';
import { type DebouncedFunc, type GeneratorFn } from '@finos/legend-shared';
import React from 'react';
import { type CustomDatePickerValueSpecification, type CustomDatePickerUpdateValueSpecification } from './CustomDatePickerHelper.js';
import type { V1_TypeCheckOption } from './V1_BasicValueSpecificationEditor.js';
export type TypeCheckOption = {
    expectedType: Type;
    /**
     * Indicates if a strict type-matching will happen.
     * Sometimes, auto-boxing allow some rooms to wiggle,
     * for example we can assign a Float to an Integer, a
     * Date to a DateTime. With this flag set to `true`
     * we will not allow this.
     *
     * For example, if `match=true`, it means that options in the
     * date-capability-dropdown which are not returning type DateTime
     * will be filtered out.
     */
    match?: boolean;
};
export declare const VariableInfoTooltip: React.FC<{
    variable: VariableExpression;
    children: React.ReactElement;
    placement?: TooltipPlacement | undefined;
}>;
export declare const QUERY_BUILDER_VARIABLE_DND_TYPE = "VARIABLE";
export interface QueryBuilderVariableDragSource {
    variable: VariableExpression;
}
/**
 * This is the base interface for primitive instance value editors (non-collection values).
 * The interface is made generic so that it can support various types of objects that hold the value
 * to be edited (currently, we just use this for ValueSpecification and V1_ValueSpecification).
 *
 * T represents the type of the object that holds the value to be edited (i.e. ValueSpecification or V1_ValueSpecification).
 * U represents the type of data that the object holds.
 *
 * valueSelector: callback that handles extracting the data value from the object.
 * updateValueSpecification: callback that takes the valueSpecification object and the new value and handles updating
 * the object with the new value.
 * errorChecker: optional callback that should return true if the valueSpecification is invalid.
 */
export interface PrimitiveInstanceValueEditorProps<T, U extends string | number | boolean | Enum | null> {
    valueSpecification: T;
    valueSelector: (val: T) => U;
    updateValueSpecification: (valueSpecification: T, value: U) => void;
    errorChecker?: (valueSpecification: T) => boolean;
    resetValue: () => void;
    handleBlur?: (() => void) | undefined;
    handleKeyDown?: React.KeyboardEventHandler<HTMLDivElement> | undefined;
    className?: string | undefined;
    readOnly?: boolean | undefined;
}
export interface BasicValueSpecificationEditorSelectorSearchConfig {
    values: string[] | undefined;
    isLoading: boolean;
    reloadValues: DebouncedFunc<(inputValue: string) => GeneratorFn<void>> | undefined;
    cleanUpReloadValues?: () => void;
}
export interface BasicValueSpecificationEditorSelectorConfig {
    optionCustomization?: {
        rowHeight?: number | undefined;
    } | undefined;
}
interface StringPrimitiveInstanceValueEditorProps<T> extends PrimitiveInstanceValueEditorProps<T, string | null> {
    selectorSearchConfig?: BasicValueSpecificationEditorSelectorSearchConfig | undefined;
    selectorConfig?: BasicValueSpecificationEditorSelectorConfig | undefined;
    lightMode?: boolean | undefined;
}
declare const StringPrimitiveInstanceValueEditorInner: <T>(props: StringPrimitiveInstanceValueEditorProps<T>, ref: React.ForwardedRef<HTMLInputElement | SelectComponent | null>) => React.ReactElement;
export declare const StringPrimitiveInstanceValueEditor: (<T>(props: StringPrimitiveInstanceValueEditorProps<T> & {
    ref: React.ForwardedRef<HTMLInputElement | SelectComponent | null>;
}) => ReturnType<typeof StringPrimitiveInstanceValueEditorInner>) & {
    displayName: string;
};
type BooleanInstanceValueEditorProps<T> = PrimitiveInstanceValueEditorProps<T, boolean>;
declare const BooleanInstanceValueEditorInner: <T>(props: BooleanInstanceValueEditorProps<T>) => React.ReactElement;
export declare const BooleanPrimitiveInstanceValueEditor: (<T>(props: BooleanInstanceValueEditorProps<T>) => ReturnType<typeof BooleanInstanceValueEditorInner>) & {
    displayName: string;
};
interface NumberPrimitiveInstanceValueEditorProps<T> extends PrimitiveInstanceValueEditorProps<T, number | null> {
    isInteger: boolean;
    enableExpressionCalculation?: boolean | undefined;
}
declare const NumberPrimitiveInstanceValueEditorInner: <T>(props: NumberPrimitiveInstanceValueEditorProps<T>, ref: React.ForwardedRef<HTMLInputElement>) => React.ReactElement;
export declare const NumberPrimitiveInstanceValueEditor: (<T>(props: NumberPrimitiveInstanceValueEditorProps<T> & {
    ref: React.ForwardedRef<HTMLInputElement>;
}) => ReturnType<typeof NumberPrimitiveInstanceValueEditorInner>) & {
    displayName: string;
};
/**
 * Generic interface for handling editing enum values. The editor component
 * expects an options array which contains the list of possible enum values.
 */
interface EnumInstanceValueEditorProps<T> extends PrimitiveInstanceValueEditorProps<T, string | null> {
    options: {
        label: string;
        value: string;
    }[];
    selectorConfig?: BasicValueSpecificationEditorSelectorConfig | undefined;
    lightMode?: boolean | undefined;
}
declare const EnumInstanceValueEditorInner: <T>(props: EnumInstanceValueEditorProps<T>) => React.ReactElement;
export declare const EnumInstanceValueEditor: (<T>(props: EnumInstanceValueEditorProps<T>) => ReturnType<typeof EnumInstanceValueEditorInner>) & {
    displayName: string;
};
/**
 * This is the base interface for collection primitive instance value editors.
 * The interface is made generic so that it can support various types of objects that hold the value
 * to be edited (currently, we just use this for CollectionInstanceValue and V1_Collection).
 *
 * T represents the type of the objects held in the collection (i.e. ValueSpecification or V1_ValueSpecification).
 * U represents the interface of the collection object (i.e. CollectionInstanceValue or V1_Collection). Currently,
 * this only supports collection objects that hold their data in a property called values.
 *
 * updateValueSpecification: callback that takes the collection object and the new values and handles updating
 * the collection object with the new values.
 * convertTextToValueSpecification: callback that takes a string and converts it to the expected valueSpecification type.
 * convertValueSpecificationToText: callback that takes a valueSpecification and converts it to a string.
 * expectedType: the expected type of the values in the collection.
 * errorChecker: optional callback that should return true if the valueSpecification is invalid.
 */
interface PrimitiveCollectionInstanceValueEditorProps<T, U extends {
    values: T[];
}> {
    valueSpecification: U;
    updateValueSpecification: (valueSpecification: U, values: T[]) => void;
    convertTextToValueSpecification: (type: Type | V1_PackageableType, text: string) => T | null;
    convertValueSpecificationToText: (valueSpecification: T) => string | undefined;
    expectedType: Type | V1_PackageableType;
    saveEdit: () => void;
    selectorSearchConfig?: BasicValueSpecificationEditorSelectorSearchConfig | undefined;
    selectorConfig?: BasicValueSpecificationEditorSelectorConfig | undefined;
    errorChecker?: (valueSpecification: U) => boolean;
    className?: string | undefined;
    lightMode?: boolean | undefined;
    readOnly?: boolean | undefined;
}
declare const PrimitiveCollectionInstanceValueEditorInner: <T, U extends {
    values: T[];
}>(props: PrimitiveCollectionInstanceValueEditorProps<T, U>) => React.ReactElement;
export declare const PrimitiveCollectionInstanceValueEditor: (<T, U extends {
    values: T[];
}>(props: PrimitiveCollectionInstanceValueEditorProps<T, U>) => ReturnType<typeof PrimitiveCollectionInstanceValueEditorInner>) & {
    displayName: string;
};
interface EnumCollectionInstanceValueEditorProps<T, U extends {
    values: T[];
}> extends PrimitiveCollectionInstanceValueEditorProps<T, U> {
    enumOptions: {
        label: string;
        value: string;
    }[] | undefined;
}
declare const EnumCollectionInstanceValueEditorInner: <T, U extends {
    values: T[];
}>(props: EnumCollectionInstanceValueEditorProps<T, U>) => React.ReactElement;
export declare const EnumCollectionInstanceValueEditor: (<T, U extends {
    values: T[];
}>(props: EnumCollectionInstanceValueEditorProps<T, U>) => ReturnType<typeof EnumCollectionInstanceValueEditorInner>) & {
    displayName: string;
};
interface CollectionValueInstanceValueEditorProps<T, U extends {
    values: T[];
}> extends Omit<PrimitiveCollectionInstanceValueEditorProps<T, U>, 'saveEdit'>, Omit<EnumCollectionInstanceValueEditorProps<T, U>, 'saveEdit'> {
    stringifyCollectionValueSpecification: (valueSpecification: U) => string;
}
declare const CollectionValueInstanceValueEditorInner: <T, U extends {
    values: T[];
}>(props: CollectionValueInstanceValueEditorProps<T, U>) => React.ReactElement;
export declare const CollectionValueInstanceValueEditor: (<T, U extends {
    values: T[];
}>(props: CollectionValueInstanceValueEditorProps<T, U>) => ReturnType<typeof CollectionValueInstanceValueEditorInner>) & {
    displayName: string;
};
interface DateInstanceValueEditorProps<T extends CustomDatePickerValueSpecification | undefined> extends Omit<PrimitiveInstanceValueEditorProps<T, string | null>, 'updateValueSpecification'> {
    updateValueSpecification: CustomDatePickerUpdateValueSpecification<T>;
    typeCheckOption: TypeCheckOption | V1_TypeCheckOption;
    displayAsEditableValue?: boolean | undefined;
}
declare const DateInstanceValueEditorInner: <T extends CustomDatePickerValueSpecification | undefined>(props: DateInstanceValueEditorProps<T>) => React.ReactElement;
export declare const DateInstanceValueEditor: (<T extends CustomDatePickerValueSpecification | undefined>(props: DateInstanceValueEditorProps<T>) => ReturnType<typeof DateInstanceValueEditorInner>) & {
    displayName: string;
};
/**
 * TODO we should pass in the props `resetValueSpecification`. Reset
 * should be part of this editor. Also through here we can call `observe_` accordingly.
 *
 * See https://github.com/finos/legend-studio/pull/1021
 */
export declare const BasicValueSpecificationEditor: React.ForwardRefExoticComponent<{
    valueSpecification: ValueSpecification;
    graph: PureModel;
    observerContext: ObserverContext;
    typeCheckOption: TypeCheckOption;
    className?: string | undefined;
    setValueSpecification: (val: ValueSpecification) => void;
    resetValue: () => void;
    isConstant?: boolean | undefined;
    selectorSearchConfig?: BasicValueSpecificationEditorSelectorSearchConfig | undefined;
    selectorConfig?: BasicValueSpecificationEditorSelectorConfig | undefined;
    handleBlur?: (() => void) | undefined;
    handleKeyDown?: ((event: React.KeyboardEvent<HTMLInputElement>) => void) | undefined;
    displayDateEditorAsEditableValue?: boolean | undefined;
    readOnly?: boolean | undefined;
    enableExpressionCalculation?: boolean | undefined;
} & React.RefAttributes<HTMLInputElement | null>>;
export declare const EditableBasicValueSpecificationEditor: ((props: {
    valueSpecification: ValueSpecification;
    setValueSpecification: (valueSpec: ValueSpecification) => void;
    graph: PureModel;
    observerContext: ObserverContext;
    typeCheckOption: TypeCheckOption;
    resetValue: () => void;
    selectorSearchConfig?: BasicValueSpecificationEditorSelectorSearchConfig | undefined;
    selectorConfig?: BasicValueSpecificationEditorSelectorConfig | undefined;
    isConstant?: boolean;
    initializeAsEditable?: boolean;
    readOnly?: boolean;
    enableExpressionCalculation?: boolean | undefined;
    displayAsString?: boolean | undefined;
}) => import("react/jsx-runtime").JSX.Element) & {
    displayName: string;
};
export {};
//# sourceMappingURL=BasicValueSpecificationEditor.d.ts.map