import { AvatarNetwork } from '@agorapulse/ui-components/avatar';
import { Period, Locale, FirstDayOfWeek } from '@agorapulse/ui-components/datepicker';
import dayjs from 'dayjs';
import { SelectLabelSingleDisplayType } from '@agorapulse/ui-components/select';
import { TagColor } from '@agorapulse/ui-components/tag';
import * as _angular_core from '@angular/core';
import { TemplateRef } from '@angular/core';
import { DropdownOverlay } from '@agorapulse/ui-components/dropdown-base';
import { ActionDropdownItem } from '@agorapulse/ui-components/action-dropdown';

type FilterDropdownType = 'checkbox' | 'radio' | 'toggle' | 'select' | 'date-range';
interface FilterDropdownItemCheckbox {
    label: string;
    name: string;
    disabled?: boolean;
}
interface FilterDropdownItemRadio {
    label: string;
    radioId: string;
    value: unknown;
    disabled?: boolean;
}
interface FilterDropdownItemToggle {
    label: string;
    name: string;
    disabled?: boolean;
}
interface FilterDropdownItemSelect {
    label: string;
    value: unknown;
    featureLocked?: boolean;
    caption?: string;
    avatarUrl?: string;
    symbolId?: string;
    disabled?: boolean;
    badgeText?: string;
    network?: AvatarNetwork;
    dividerEnabled?: boolean;
    tagColor?: TagColor;
}
interface FilterDropdownValueCheckbox {
    filterType: 'checkbox';
    /** Names of the checked items */
    selected: string[];
}
interface FilterDropdownValueRadio {
    filterType: 'radio';
    selected: unknown;
}
interface FilterDropdownValueToggle {
    filterType: 'toggle';
    checked: boolean;
}
interface FilterDropdownValueSingleSelect {
    filterType: 'select';
    selectionType: 'single';
    selected: unknown;
}
interface FilterDropdownValueMultipleSelect {
    filterType: 'select';
    selectionType: 'multiple';
    selected: unknown[];
}
interface FilterDropdownValueDateRange {
    filterType: 'date-range';
    selectedPeriod?: Period;
}
type FilterDropdownValue = FilterDropdownValueCheckbox | FilterDropdownValueRadio | FilterDropdownValueToggle | FilterDropdownValueSingleSelect | FilterDropdownValueMultipleSelect | FilterDropdownValueDateRange;
/** The output emitted by filter-dropdown on apply: a map of filter key → value */
type FilterDropdownOutput = Record<string, FilterDropdownValue>;
interface FilterDropdownGroupBase {
    /** Unique key to identify this filter in the output */
    key: string;
    /** The title of the filter group to display in the UI */
    title: string;
    /** Whether the filter group is expanded (open) or collapsed by default. Only applicable if `closable` is true. */
    expanded?: boolean;
    /** An optional label to display under the filter group title */
    label?: string;
    /** An optional tooltip text that if presents has the symbol "info" next to the title and shows the tooltip on hover. */
    tooltipText?: string;
    /** An optional placeholder in the input value */
    placeholder?: string;
    /** Whether the group is feature locked */
    featureLocked?: boolean;
    /** Whether the group is feature locked */
    featureLockTooltipText?: string;
}
interface FilterDropdownGroupCheckbox extends FilterDropdownGroupBase {
    /** The type of the FilterDropdownGroupBase */
    filterType: 'checkbox';
    items: FilterDropdownItemCheckbox[];
    defaultSelected?: string[];
}
interface FilterDropdownGroupRadio extends FilterDropdownGroupBase {
    /** The type of the FilterDropdownGroupBase */
    filterType: 'radio';
    items: FilterDropdownItemRadio[];
    defaultSelected?: unknown;
}
interface FilterDropdownGroupToggle extends FilterDropdownGroupBase {
    /** The type of the FilterDropdownGroupBase */
    filterType: 'toggle';
    item: FilterDropdownItemToggle;
    defaultSelected?: boolean;
}
interface FilterDropdownGroupSelectSingle extends FilterDropdownGroupBase {
    /** An optional label to display next to each filter item (e.g. "and", "or"). Only applicable for checkbox, radio and toggle filter groups. */
    inlineLabel?: string;
    /** The type of the FilterDropdownGroupBase */
    filterType: 'select';
    /** Whether the select allows single selection */
    selectionType: 'single';
    /** An optional type to determine the icon/avatar/symbol to display for each item. Only applicable for select filter groups. */
    displayType: SelectLabelSingleDisplayType;
    /** An optional text to display when all items are selected. Only applicable for select filter groups with multiple selection. */
    onlyText?: string;
    items: FilterDropdownItemSelect[];
    defaultSelected?: unknown;
}
interface FilterDropdownGroupSelectMultiple extends FilterDropdownGroupBase {
    /** An optional label to display next to each filter item (e.g. "and", "or"). Only applicable for checkbox, radio and toggle filter groups. */
    inlineLabel?: string;
    /** The type of the FilterDropdownGroupBase */
    filterType: 'select';
    /** Whether the select allows single or multiple selection */
    selectionType: 'multiple';
    /** An optional type to determine the icon/avatar/symbol to display for each item. Only applicable for select filter groups. */
    displayType: SelectLabelSingleDisplayType;
    /** An optional text to display when all items are selected. Only applicable for select filter groups with multiple selection. */
    onlyText?: string;
    items: FilterDropdownItemSelect[];
    defaultSelected?: unknown[];
}
interface FilterDropdownGroupDateRange extends FilterDropdownGroupBase {
    /** The type of the FilterDropdownGroupBase */
    filterType: 'date-range';
    minDate?: dayjs.Dayjs;
    maxDate?: dayjs.Dayjs;
    selectedPeriod?: Period;
    locale?: Locale;
    firstDayOfWeek?: FirstDayOfWeek;
    dateFormat?: string;
}
type FilterDropdownGroup = FilterDropdownGroupCheckbox | FilterDropdownGroupRadio | FilterDropdownGroupToggle | FilterDropdownGroupSelectSingle | FilterDropdownGroupSelectMultiple | FilterDropdownGroupDateRange;

declare class FilterState {
    private readonly _groups;
    private readonly _draft;
    private readonly _baseline;
    activeFilterCount: _angular_core.Signal<number>;
    readonly groups: _angular_core.Signal<FilterDropdownGroup[]>;
    readonly draft: _angular_core.Signal<FilterDropdownOutput>;
    isFilterCountActive: _angular_core.Signal<boolean>;
    readonly hasChanges: _angular_core.Signal<boolean>;
    readonly buttonsDisabled: _angular_core.Signal<boolean>;
    /** Refresh the groups schema and (re-)seed the draft + baseline from config defaults. */
    initialize(groups: FilterDropdownGroup[]): void;
    /** Adopt the current draft as the baseline (called on Apply / Save / Update). */
    commit(): void;
    private buildValues;
    collapseHeader(key: string): void;
    /** Get the draft value for a specific filter key */
    getValue(key: string): FilterDropdownValue | undefined;
    /** Update a single filter's draft value */
    updateValue(key: string, value: FilterDropdownValue): void;
    /** Toggle a checkbox item in a checkbox filter */
    toggleCheckbox(key: string, name: string, checked: boolean): void;
    /** Set the selected radio value */
    setRadioValue(key: string, value: unknown): void;
    /** Set the toggle checked state */
    setToggleValue(key: string, checked: boolean): void;
    /** Set selected indices for a select filter */
    setSingleSelectValue(key: string, selected: unknown): void;
    setMultipleSelectValue(key: string, selected: unknown[]): void;
    /** Set the selected period for a date range filter */
    setDateRangeValue(key: string, selectedPeriod: Period): void;
    /** Return the current draft snapshot (used on Apply) */
    getSnapshot(): FilterDropdownOutput;
    /** Revert the draft to the committed baseline. */
    reset(): void;
    /** Clear all draft values to empty/default states */
    clear(): void;
    private buildInitialValue;
    private buildEmptyValue;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<FilterState, never>;
    static ɵprov: _angular_core.ɵɵInjectableDeclaration<FilterState>;
}

declare class FilterDropdownComponent implements DropdownOverlay {
    private readonly overlay;
    readonly filterState: FilterState;
    initGroups: _angular_core.EffectRef;
    emitOnValueChange: _angular_core.EffectRef;
    filterGroupTemplate: _angular_core.Signal<TemplateRef<unknown> | undefined>;
    /**
     * The filter groups to display, with their default/initial selection. Configuration, not a live value
     * binding: update only on external changes — never feed the component's own output back in (apply→items→apply loop).
     */
    items: _angular_core.InputSignal<FilterDropdownGroup[] | undefined>;
    /** Whether the filter needs the apply button to be clicked for applyFilters to emit  */
    needApplyButton: _angular_core.InputSignal<boolean>;
    /** Whether the filter group can be closed (collapsed) by the user. If false, the group will always be expanded and the user won't see a toggle button. */
    closable: _angular_core.InputSignal<boolean>;
    /** whether the feature to save presets is locked for the org */
    presetsFeatureLocked: _angular_core.InputSignal<boolean>;
    /** whether the mode is in preset mode */
    savePresetsMode: _angular_core.InputSignal<boolean>;
    /** whether the user is currently editing presets. Only necessary if savePresetsMode is at true */
    editingPresetsMode: _angular_core.InputSignal<boolean>;
    /** Whether to show a backdrop that closes the dropdown when clicked */
    showBackdrop: _angular_core.InputSignal<boolean>;
    /** Default position for the dropdown relative to the trigger element */
    defaultPosition: _angular_core.InputSignal<"left" | "right">;
    saveNewPresetsText: _angular_core.InputSignal<string>;
    saveAsNewPresetText: _angular_core.InputSignal<string>;
    savePresetText: _angular_core.InputSignal<string>;
    updateExistingPresetText: _angular_core.InputSignal<string>;
    resetFilterText: _angular_core.InputSignal<string>;
    applyFiltersText: _angular_core.InputSignal<string>;
    clearFilterText: _angular_core.InputSignal<string>;
    /** Emits when the dropdown menu is opened */
    opened: _angular_core.OutputEmitterRef<void>;
    /** Emits when the dropdown menu is closed */
    closed: _angular_core.OutputEmitterRef<void>;
    /** Emits when save presets is clicked but is feature locked */
    presetsLockedClicked: _angular_core.OutputEmitterRef<void>;
    /** Emits when save presets is clicked */
    saveNewPresets: _angular_core.OutputEmitterRef<FilterDropdownOutput>;
    /** Emits when save presets is clicked */
    updatePresets: _angular_core.OutputEmitterRef<FilterDropdownOutput>;
    /** Emits when filters are applied */
    applyFilters: _angular_core.OutputEmitterRef<FilterDropdownOutput>;
    /** Emits when user clicks on clear filter */
    clearFilters: _angular_core.OutputEmitterRef<void>;
    /** Emits when user clicks on reset filter */
    resetFilters: _angular_core.OutputEmitterRef<void>;
    /** Event emitted when a select item feature locked is clicked */
    lockedFeatureClicked: _angular_core.OutputEmitterRef<FilterDropdownItemSelect>;
    /** Event emitted when a group with locked feature is clicked */
    filterDropdownGroupLockedClicked: _angular_core.OutputEmitterRef<FilterDropdownGroup>;
    readonly isOpen: _angular_core.Signal<boolean>;
    savePresetsDropdownItems: _angular_core.Signal<ActionDropdownItem[]>;
    /** Opens the dropdown menu at the specified trigger element */
    open(triggerElement?: HTMLElement): void;
    /** Closes the dropdown menu and cleans up overlay resources */
    close(): void;
    /** Toggles the dropdown menu open or closed state */
    toggle(triggerElement?: HTMLElement): void;
    onApplyFilters(): void;
    onClearFilters(): void;
    onResetFilters(): void;
    onSavePresets(): void;
    onUpdatePresets(): void;
    protected onActionDropdownItemClick(item: ActionDropdownItem): void;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<FilterDropdownComponent, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<FilterDropdownComponent, "ap-filter-dropdown", never, { "items": { "alias": "items"; "required": false; "isSignal": true; }; "needApplyButton": { "alias": "needApplyButton"; "required": false; "isSignal": true; }; "closable": { "alias": "closable"; "required": false; "isSignal": true; }; "presetsFeatureLocked": { "alias": "presetsFeatureLocked"; "required": false; "isSignal": true; }; "savePresetsMode": { "alias": "savePresetsMode"; "required": false; "isSignal": true; }; "editingPresetsMode": { "alias": "editingPresetsMode"; "required": false; "isSignal": true; }; "showBackdrop": { "alias": "showBackdrop"; "required": false; "isSignal": true; }; "defaultPosition": { "alias": "defaultPosition"; "required": false; "isSignal": true; }; "saveNewPresetsText": { "alias": "saveNewPresetsText"; "required": false; "isSignal": true; }; "saveAsNewPresetText": { "alias": "saveAsNewPresetText"; "required": false; "isSignal": true; }; "savePresetText": { "alias": "savePresetText"; "required": false; "isSignal": true; }; "updateExistingPresetText": { "alias": "updateExistingPresetText"; "required": false; "isSignal": true; }; "resetFilterText": { "alias": "resetFilterText"; "required": false; "isSignal": true; }; "applyFiltersText": { "alias": "applyFiltersText"; "required": false; "isSignal": true; }; "clearFilterText": { "alias": "clearFilterText"; "required": false; "isSignal": true; }; }, { "opened": "opened"; "closed": "closed"; "presetsLockedClicked": "presetsLockedClicked"; "saveNewPresets": "saveNewPresets"; "updatePresets": "updatePresets"; "applyFilters": "applyFilters"; "clearFilters": "clearFilters"; "resetFilters": "resetFilters"; "lockedFeatureClicked": "lockedFeatureClicked"; "filterDropdownGroupLockedClicked": "filterDropdownGroupLockedClicked"; }, never, never, true, never>;
}

declare class FilterDropdownButtonComponent {
    private readonly filterDropdown;
    isFilterCountActive: _angular_core.Signal<boolean>;
    activeFilterCount: _angular_core.Signal<number>;
    /** text of the button, input specific to the button */
    buttonFilterText: _angular_core.InputSignal<string>;
    /** input specific to the filter-dropdown */
    /**
     * The filter groups to display, with their default/initial selection. Configuration, not a live value
     * binding: update only on external changes — never feed the component's own output back in (apply→items→apply loop).
     */
    items: _angular_core.InputSignal<FilterDropdownGroup[] | undefined>;
    /** Whether the filter needs the apply button to be clicked for applyFilters to emit  */
    needApplyButton: _angular_core.InputSignal<boolean>;
    /** Whether the filter group can be closed (collapsed) by the user. If false, the group will always be expanded and the user won't see a toggle button. */
    closable: _angular_core.InputSignal<boolean>;
    /** whether the feature to save presets is locked for the org */
    presetsFeatureLocked: _angular_core.InputSignal<boolean>;
    /** whether the mode is in preset mode */
    savePresetsMode: _angular_core.InputSignal<boolean>;
    /** whether the user is currently editing presets. Only necessary if savePresetsMode is at true */
    editingPresetsMode: _angular_core.InputSignal<boolean>;
    /** Whether to show a backdrop that closes the dropdown when clicked */
    showBackdrop: _angular_core.InputSignal<boolean>;
    /** Whether the dropdown is disabled and cannot be opened */
    disabled: _angular_core.InputSignal<boolean>;
    /** Default position for the dropdown relative to the trigger element */
    defaultPosition: _angular_core.InputSignal<"left" | "right">;
    saveNewPresetsText: _angular_core.InputSignal<string>;
    saveAsNewPresetText: _angular_core.InputSignal<string>;
    savePresetText: _angular_core.InputSignal<string>;
    updateExistingPresetText: _angular_core.InputSignal<string>;
    resetFilterText: _angular_core.InputSignal<string>;
    applyFiltersText: _angular_core.InputSignal<string>;
    clearFilterText: _angular_core.InputSignal<string>;
    /** Emits when the dropdown menu is opened */
    opened: _angular_core.OutputEmitterRef<void>;
    /** Emits when the dropdown menu is closed */
    closed: _angular_core.OutputEmitterRef<void>;
    /** Emits when save presets is clicked but is feature locked */
    presetsLockedClicked: _angular_core.OutputEmitterRef<void>;
    /** Emits when save presets is clicked */
    saveNewPresets: _angular_core.OutputEmitterRef<FilterDropdownOutput>;
    /** Emits when save presets is clicked */
    updatePresets: _angular_core.OutputEmitterRef<FilterDropdownOutput>;
    /** Emits when filters are applied */
    applyFilters: _angular_core.OutputEmitterRef<FilterDropdownOutput>;
    /** Emits when user clicks on clear filter */
    clearFilters: _angular_core.OutputEmitterRef<void>;
    /** Emits when user clicks on reset filter */
    resetFilters: _angular_core.OutputEmitterRef<void>;
    /** Event emitted when a select item feature locked is clicked */
    lockedFeatureClicked: _angular_core.OutputEmitterRef<FilterDropdownItemSelect>;
    /** Event emitted when a group with locked feature is clicked */
    filterDropdownGroupLockedClicked: _angular_core.OutputEmitterRef<FilterDropdownGroup>;
    static ɵfac: _angular_core.ɵɵFactoryDeclaration<FilterDropdownButtonComponent, never>;
    static ɵcmp: _angular_core.ɵɵComponentDeclaration<FilterDropdownButtonComponent, "ap-filter-dropdown-button", never, { "buttonFilterText": { "alias": "buttonFilterText"; "required": false; "isSignal": true; }; "items": { "alias": "items"; "required": false; "isSignal": true; }; "needApplyButton": { "alias": "needApplyButton"; "required": false; "isSignal": true; }; "closable": { "alias": "closable"; "required": false; "isSignal": true; }; "presetsFeatureLocked": { "alias": "presetsFeatureLocked"; "required": false; "isSignal": true; }; "savePresetsMode": { "alias": "savePresetsMode"; "required": false; "isSignal": true; }; "editingPresetsMode": { "alias": "editingPresetsMode"; "required": false; "isSignal": true; }; "showBackdrop": { "alias": "showBackdrop"; "required": false; "isSignal": true; }; "disabled": { "alias": "disabled"; "required": false; "isSignal": true; }; "defaultPosition": { "alias": "defaultPosition"; "required": false; "isSignal": true; }; "saveNewPresetsText": { "alias": "saveNewPresetsText"; "required": false; "isSignal": true; }; "saveAsNewPresetText": { "alias": "saveAsNewPresetText"; "required": false; "isSignal": true; }; "savePresetText": { "alias": "savePresetText"; "required": false; "isSignal": true; }; "updateExistingPresetText": { "alias": "updateExistingPresetText"; "required": false; "isSignal": true; }; "resetFilterText": { "alias": "resetFilterText"; "required": false; "isSignal": true; }; "applyFiltersText": { "alias": "applyFiltersText"; "required": false; "isSignal": true; }; "clearFilterText": { "alias": "clearFilterText"; "required": false; "isSignal": true; }; }, { "opened": "opened"; "closed": "closed"; "presetsLockedClicked": "presetsLockedClicked"; "saveNewPresets": "saveNewPresets"; "updatePresets": "updatePresets"; "applyFilters": "applyFilters"; "clearFilters": "clearFilters"; "resetFilters": "resetFilters"; "lockedFeatureClicked": "lockedFeatureClicked"; "filterDropdownGroupLockedClicked": "filterDropdownGroupLockedClicked"; }, never, never, true, never>;
}

export { FilterDropdownButtonComponent, FilterDropdownComponent };
export type { FilterDropdownGroup, FilterDropdownGroupCheckbox, FilterDropdownGroupDateRange, FilterDropdownGroupRadio, FilterDropdownGroupSelectMultiple, FilterDropdownGroupSelectSingle, FilterDropdownGroupToggle, FilterDropdownItemCheckbox, FilterDropdownItemRadio, FilterDropdownItemSelect, FilterDropdownItemToggle, FilterDropdownOutput, FilterDropdownType, FilterDropdownValue, FilterDropdownValueCheckbox, FilterDropdownValueDateRange, FilterDropdownValueMultipleSelect, FilterDropdownValueRadio, FilterDropdownValueSingleSelect, FilterDropdownValueToggle };
