import * as _angular_core from '@angular/core';
import { TemplateRef, ElementRef, PipeTransform } from '@angular/core';
import { ZCalendarSize, ZDateRange } from '@shival99/z-ui/components/z-calendar';
import { ZIcon } from '@shival99/z-ui/components/z-icon';
import { ClassValue } from 'clsx';
import * as class_variance_authority_types from 'class-variance-authority/types';

type ZFilterSize = 'sm' | 'md' | 'lg';
type ZFilterFieldType = 'select' | 'multiselect' | 'date' | 'daterange' | 'text' | 'number' | 'numberrange' | 'boolean' | 'email' | 'url' | 'tel' | 'time' | 'datetime' | 'custom' | 'separator';
interface ZFilterOption<T = unknown> {
    value: T;
    label: string;
    icon?: ZIcon;
    metadata?: Record<string, unknown>;
}
interface ZFilterOperator {
    value: string;
    label: string;
    supportsMultiple?: boolean;
}
interface ZFilterCustomRendererContext<T = unknown> {
    field: ZFilterFieldConfig<T>;
    values: T[];
    operator: string;
    onChange: (values: T[]) => void;
}
interface ZFilterFieldConfig<T = unknown> {
    key?: string;
    label?: string;
    icon?: ZIcon;
    type?: ZFilterFieldType;
    group?: string;
    fields?: ZFilterFieldConfig<T>[];
    options?: ZFilterOption<T>[];
    operators?: ZFilterOperator[];
    customRenderer?: TemplateRef<ZFilterCustomRendererContext<T>>;
    customValueRenderer?: TemplateRef<{
        values: T[];
        options: ZFilterOption<T>[];
    }>;
    placeholder?: string;
    searchable?: boolean;
    maxSelections?: number;
    min?: number;
    max?: number;
    step?: number;
    prefix?: string;
    suffix?: string;
    pattern?: string;
    validation?: (value: unknown) => boolean;
    allowCustomValues?: boolean;
    className?: string;
    popoverContentClassName?: string;
    selectedOptionsClassName?: string;
    onLabel?: string;
    offLabel?: string;
    defaultOperator?: string;
}
interface ZFilterFieldGroup<T = unknown> {
    group?: string;
    fields: ZFilterFieldConfig<T>[];
}
type ZFilterFieldsConfig<T = unknown> = ZFilterFieldConfig<T>[] | ZFilterFieldGroup<T>[];
interface ZFilter<T = unknown> {
    id: string;
    field: string;
    operator: string;
    values: T[];
}
interface ZFilterI18nConfig {
    addFilter: string;
    searchFields: string;
    noFieldsFound: string;
    noResultsFound: string;
    select: string;
    true: string;
    false: string;
    min: string;
    max: string;
    to: string;
    selected: string;
    selectedCount: string;
    addFilterTitle: string;
    operators: {
        is: string;
        isNot: string;
        isAnyOf: string;
        isNotAnyOf: string;
        includesAll: string;
        excludesAll: string;
        before: string;
        after: string;
        between: string;
        notBetween: string;
        contains: string;
        notContains: string;
        startsWith: string;
        endsWith: string;
        isExactly: string;
        equals: string;
        notEquals: string;
        greaterThan: string;
        lessThan: string;
        overlaps: string;
        includes: string;
        excludes: string;
        includesAllOf: string;
        includesAnyOf: string;
        empty: string;
        notEmpty: string;
    };
    placeholders: {
        enterField: string;
        selectField: string;
        searchField: string;
        enterKey: string;
        enterValue: string;
    };
    validation: {
        invalidEmail: string;
        invalidUrl: string;
        invalidTel: string;
        invalid: string;
    };
}
declare const DEFAULT_FILTER_I18N: ZFilterI18nConfig;

declare class ZFilterComponent<T = unknown> {
    readonly addButtonTemplate: _angular_core.Signal<TemplateRef<unknown> | undefined>;
    readonly zFiltersChange: _angular_core.OutputEmitterRef<ZFilter<T>[]>;
    readonly zFilterAdd: _angular_core.OutputEmitterRef<ZFilter<T>>;
    readonly zFilterRemove: _angular_core.OutputEmitterRef<ZFilter<T>>;
    readonly zFilterUpdate: _angular_core.OutputEmitterRef<{
        filter: ZFilter<T>;
        updates: Partial<ZFilter<T>>;
    }>;
    readonly class: _angular_core.InputSignal<ClassValue>;
    readonly zFilters: _angular_core.InputSignal<ZFilter<T>[]>;
    readonly zFields: _angular_core.InputSignal<ZFilterFieldsConfig<T>>;
    readonly zSize: _angular_core.InputSignal<ZFilterSize>;
    readonly zI18n: _angular_core.InputSignal<Partial<ZFilterI18nConfig>>;
    readonly zShowAddButton: _angular_core.InputSignal<boolean>;
    readonly zAllowMultiple: _angular_core.InputSignal<boolean>;
    readonly zAddButtonIcon: _angular_core.InputSignal<ZIcon>;
    readonly zAddButtonText: _angular_core.InputSignal<string | undefined>;
    protected readonly addFilterOpen: _angular_core.WritableSignal<boolean>;
    protected readonly searchQuery: _angular_core.WritableSignal<string>;
    protected readonly operatorPopoverOpen: _angular_core.WritableSignal<string | null>;
    protected readonly valuePopoverOpen: _angular_core.WritableSignal<string | null>;
    protected readonly addFilterSearchInput: _angular_core.Signal<ElementRef<HTMLInputElement> | undefined>;
    protected focusSearchInput(): void;
    protected focusSelectSearch(filterId: string): void;
    protected readonly i18n: _angular_core.Signal<ZFilterI18nConfig>;
    protected readonly fieldsMap: _angular_core.Signal<Record<string, ZFilterFieldConfig<T>>>;
    protected readonly selectableFields: _angular_core.Signal<ZFilterFieldConfig<T>[]>;
    protected readonly filteredFields: _angular_core.Signal<ZFilterFieldConfig<T>[]>;
    protected readonly groupedFields: _angular_core.Signal<{
        group: string;
        fields: ZFilterFieldConfig<T>[];
    }[]>;
    protected readonly buttonSize: _angular_core.Signal<"sm" | "lg" | "default">;
    protected readonly calendarSize: _angular_core.Signal<ZCalendarSize>;
    protected readonly dateValueMap: _angular_core.Signal<Record<string, Date | null>>;
    protected readonly dateRangeValueMap: _angular_core.Signal<Record<string, ZDateRange | null>>;
    protected readonly timeValueMap: _angular_core.Signal<Record<string, Date | null>>;
    protected readonly dateTimeValueMap: _angular_core.Signal<Record<string, Date | null>>;
    protected readonly hostClasses: _angular_core.Signal<string>;
    protected getItemClasses(): string;
    protected getLabelClasses(): string;
    protected getInputClasses(): string;
    protected getRemoveButtonClasses(): string;
    protected getBetweenClasses(): string;
    protected getFieldForFilter(filter: ZFilter<T>): ZFilterFieldConfig<T> | undefined;
    protected getOperatorsForFilter(filter: ZFilter<T>): ZFilterOperator[];
    protected getOperatorLabel(filter: ZFilter<T>): string;
    protected getSelectedOptions(filter: ZFilter<T>): ZFilterOption<T>[];
    protected getUnselectedOptions(filter: ZFilter<T>): ZFilterOption<T>[];
    protected isValueHidden(filter: ZFilter<T>): boolean;
    protected isBetweenOperator(filter: ZFilter<T>): boolean;
    protected getInputPattern(field: ZFilterFieldConfig<T>): string | undefined;
    protected onFieldSelect(field: ZFilterFieldConfig<T>): void;
    protected updateFilterOperator(filter: ZFilter<T>, operator: string): void;
    protected onSelectValueChange(filter: ZFilter<T>, option: ZFilterOption<T>): void;
    protected onDateValueChange(filter: ZFilter<T>, value: Date | null): void;
    protected onDateRangeValueChange(filter: ZFilter<T>, value: ZDateRange | null): void;
    protected onTimeValueChange(filter: ZFilter<T>, value: Date | null): void;
    protected onDateTimeValueChange(filter: ZFilter<T>, value: Date | null): void;
    protected removeFilter(filter: ZFilter<T>): void;
    protected onInputChange(filter: ZFilter<T>, event: Event, index?: number): void;
    protected onBooleanChange(filter: ZFilter<T>, checked: boolean): void;
    protected onSearchInput(event: Event): void;
    protected trackByFilterId(index: number, filter: ZFilter<T>): string;
    protected trackByOptionValue(index: number, option: ZFilterOption<T>): unknown;
    protected trackByFieldKey(index: number, field: ZFilterFieldConfig<T>): string;
    private _updateFilterValues;
    private _parseDateValue;
    private _formatDateValue;
    private _parseTimeValue;
    private _parseDateTimeValue;
    private _formatTimeValue;
    private _formatDateTimeValue;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZFilterComponent<any>, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<ZFilterComponent<any>, "z-filter", never, { "class": { "alias": "class"; "required": false; "isSignal": true; }; "zFilters": { "alias": "zFilters"; "required": true; "isSignal": true; }; "zFields": { "alias": "zFields"; "required": true; "isSignal": true; }; "zSize": { "alias": "zSize"; "required": false; "isSignal": true; }; "zI18n": { "alias": "zI18n"; "required": false; "isSignal": true; }; "zShowAddButton": { "alias": "zShowAddButton"; "required": false; "isSignal": true; }; "zAllowMultiple": { "alias": "zAllowMultiple"; "required": false; "isSignal": true; }; "zAddButtonIcon": { "alias": "zAddButtonIcon"; "required": false; "isSignal": true; }; "zAddButtonText": { "alias": "zAddButtonText"; "required": false; "isSignal": true; }; }, { "zFiltersChange": "zFiltersChange"; "zFilterAdd": "zFilterAdd"; "zFilterRemove": "zFilterRemove"; "zFilterUpdate": "zFilterUpdate"; }, ["addButtonTemplate"], never, true, never>;
}

declare class ZFilterFieldPipe implements PipeTransform {
    transform(filter: ZFilter, fields: ZFilterFieldsConfig): ZFilterFieldConfig | undefined;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZFilterFieldPipe, never>;
    static ɵpipe: _angular_core.ɵɵPipeDeclaration<ZFilterFieldPipe, "zFilterField", true>;
}

declare class ZFilterOperatorLabelPipe implements PipeTransform {
    transform(filter: ZFilter, fields: ZFilterFieldsConfig, i18n: ZFilterI18nConfig): string;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZFilterOperatorLabelPipe, never>;
    static ɵpipe: _angular_core.ɵɵPipeDeclaration<ZFilterOperatorLabelPipe, "zFilterOperatorLabel", true>;
}

declare class ZFilterOperatorsPipe implements PipeTransform {
    transform(filter: ZFilter, fields: ZFilterFieldsConfig, i18n: ZFilterI18nConfig): ZFilterOperator[];
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZFilterOperatorsPipe, never>;
    static ɵpipe: _angular_core.ɵɵPipeDeclaration<ZFilterOperatorsPipe, "zFilterOperators", true>;
}

declare class ZFilterSelectedOptionsPipe implements PipeTransform {
    transform(filter: ZFilter, fields: ZFilterFieldsConfig): ZFilterOption[];
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZFilterSelectedOptionsPipe, never>;
    static ɵpipe: _angular_core.ɵɵPipeDeclaration<ZFilterSelectedOptionsPipe, "zFilterSelectedOptions", true>;
}

declare class ZFilterUnselectedOptionsPipe implements PipeTransform {
    transform(filter: ZFilter, fields: ZFilterFieldsConfig): ZFilterOption[];
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZFilterUnselectedOptionsPipe, never>;
    static ɵpipe: _angular_core.ɵɵPipeDeclaration<ZFilterUnselectedOptionsPipe, "zFilterUnselectedOptions", true>;
}

declare class ZFilterInputPatternPipe implements PipeTransform {
    transform(field: ZFilterFieldConfig): string;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZFilterInputPatternPipe, never>;
    static ɵpipe: _angular_core.ɵɵPipeDeclaration<ZFilterInputPatternPipe, "zFilterInputPattern", true>;
}

declare class ZFilterIsValueHiddenPipe implements PipeTransform {
    transform(filter: ZFilter): boolean;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZFilterIsValueHiddenPipe, never>;
    static ɵpipe: _angular_core.ɵɵPipeDeclaration<ZFilterIsValueHiddenPipe, "zFilterIsValueHidden", true>;
}

declare class ZFilterIsBetweenOperatorPipe implements PipeTransform {
    transform(filter: ZFilter): boolean;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<ZFilterIsBetweenOperatorPipe, never>;
    static ɵpipe: _angular_core.ɵɵPipeDeclaration<ZFilterIsBetweenOperatorPipe, "zFilterIsBetweenOperator", true>;
}

declare const Z_FILTER_PIPES: readonly [typeof ZFilterFieldPipe, typeof ZFilterOperatorLabelPipe, typeof ZFilterOperatorsPipe, typeof ZFilterSelectedOptionsPipe, typeof ZFilterUnselectedOptionsPipe, typeof ZFilterInputPatternPipe, typeof ZFilterIsValueHiddenPipe, typeof ZFilterIsBetweenOperatorPipe];

declare function createFilter<T = unknown>(field: string, operator?: string, values?: T[]): ZFilter<T>;
declare function flattenFields<T = unknown>(fields: ZFilterFieldsConfig<T>): ZFilterFieldConfig<T>[];
declare function getFieldsMap<T = unknown>(fields: ZFilterFieldsConfig<T>): Record<string, ZFilterFieldConfig<T>>;
declare function getOperatorsForField<T = unknown>(field: ZFilterFieldConfig<T>, values: T[], i18n: ZFilterI18nConfig): ZFilterOperator[];
declare function formatOperator(operator: string): string;
declare function getDefaultOperator(fieldType: string): string;
declare function getDefaultValues<T = unknown>(fieldType: string, field: ZFilterFieldConfig<T>): unknown[];
declare function getInputPattern(fieldType: string): string | undefined;

declare const zFilterContainerVariants: (props?: ({
    size?: "sm" | "md" | "lg" | null | undefined;
} & class_variance_authority_types.ClassProp) | undefined) => string;
declare const zFilterItemVariants: (props?: ({
    size?: "sm" | "md" | "lg" | null | undefined;
} & class_variance_authority_types.ClassProp) | undefined) => string;
declare const zFilterFieldLabelVariants: (props?: ({
    size?: "sm" | "md" | "lg" | null | undefined;
} & class_variance_authority_types.ClassProp) | undefined) => string;
declare const zFilterInputVariants: (props?: ({
    size?: "sm" | "md" | "lg" | null | undefined;
} & class_variance_authority_types.ClassProp) | undefined) => string;
declare const zFilterRemoveButtonVariants: (props?: ({
    size?: "sm" | "md" | "lg" | null | undefined;
} & class_variance_authority_types.ClassProp) | undefined) => string;
declare const zFilterBetweenVariants: (props?: ({
    size?: "sm" | "md" | "lg" | null | undefined;
} & class_variance_authority_types.ClassProp) | undefined) => string;

export { DEFAULT_FILTER_I18N, ZFilterComponent, ZFilterFieldPipe, ZFilterInputPatternPipe, ZFilterIsBetweenOperatorPipe, ZFilterIsValueHiddenPipe, ZFilterOperatorLabelPipe, ZFilterOperatorsPipe, ZFilterSelectedOptionsPipe, ZFilterUnselectedOptionsPipe, Z_FILTER_PIPES, createFilter, flattenFields, formatOperator, getDefaultOperator, getDefaultValues, getFieldsMap, getInputPattern, getOperatorsForField, zFilterBetweenVariants, zFilterContainerVariants, zFilterFieldLabelVariants, zFilterInputVariants, zFilterItemVariants, zFilterRemoveButtonVariants };
export type { ZFilter, ZFilterCustomRendererContext, ZFilterFieldConfig, ZFilterFieldGroup, ZFilterFieldType, ZFilterFieldsConfig, ZFilterI18nConfig, ZFilterOperator, ZFilterOption, ZFilterSize };
