// Divi dependencies.
import { ModuleEditProps } from '@divi/module-library';
import {
	InternalAttrs,
	type Element, FormatBreakpointStateAttr,
} from '@divi/types';

import type {
    AttrVal,
    BorderValue,
    TypographyValue,
    SpacingValue,
} from '../custom-types';

type BaseDecoration = Element.Decoration.PickedAttributes<
    | 'animation'
    | 'background'
    | 'border'
    | 'boxShadow'
    | 'disabledOn'
    | 'filters'
    | 'overflow'
    | 'position'
    | 'scroll'
    | 'sizing'
    | 'spacing'
    | 'sticky'
    | 'transform'
    | 'transition'
    | 'zIndex'
>;

type DecorationExtras = {
    titleColor?: FormatBreakpointStateAttr<AttrVal>;
    titleTypography?: FormatBreakpointStateAttr<TypographyValue>;
    titleMargin?: FormatBreakpointStateAttr<SpacingValue>;

    filtersPosition?: FormatBreakpointStateAttr<AttrVal>;
    filtersGapHorizontal?: FormatBreakpointStateAttr<AttrVal>;
    filtersGapVertical?: FormatBreakpointStateAttr<AttrVal>;
    filtersBgColor?: FormatBreakpointStateAttr<AttrVal>;
    filtersBorder?: FormatBreakpointStateAttr<BorderValue>;
    filtersPadding?: FormatBreakpointStateAttr<SpacingValue>;
    filtersAlignItems?: FormatBreakpointStateAttr<AttrVal>;
    filtersJustifyContent?: FormatBreakpointStateAttr<AttrVal>;

    itemMinWidth?: FormatBreakpointStateAttr<AttrVal>;
    itemPosition?: FormatBreakpointStateAttr<AttrVal>;
    itemBorder?: FormatBreakpointStateAttr<BorderValue>;
    itemBgColor?: FormatBreakpointStateAttr<AttrVal>;
    itemHoverBgColor?: FormatBreakpointStateAttr<AttrVal>;
    itemHoverBorderColor?: FormatBreakpointStateAttr<AttrVal>;
    itemPadding?: FormatBreakpointStateAttr<SpacingValue>;

    clearItemColor?: FormatBreakpointStateAttr<AttrVal>;
    clearItemBgColor?: FormatBreakpointStateAttr<AttrVal>;
    clearItemHoverColor?: FormatBreakpointStateAttr<AttrVal>;
    clearItemHoverBgColor?: FormatBreakpointStateAttr<AttrVal>;

    labelTypography?: FormatBreakpointStateAttr<TypographyValue>;
    labelColor?: FormatBreakpointStateAttr<AttrVal>;
    labelHoverColor?: FormatBreakpointStateAttr<AttrVal>;

    valueTypography?: FormatBreakpointStateAttr<TypographyValue>;
    valueColor?: FormatBreakpointStateAttr<AttrVal>;
    valueHoverColor?: FormatBreakpointStateAttr<AttrVal>;

    removeSize?: FormatBreakpointStateAttr<AttrVal>;
    removeOffsetTop?: FormatBreakpointStateAttr<AttrVal>;
    removeOffsetRight?: FormatBreakpointStateAttr<AttrVal>;
    removeColor?: FormatBreakpointStateAttr<AttrVal>;
    removeBgColor?: FormatBreakpointStateAttr<AttrVal>;
    removeHoverColor?: FormatBreakpointStateAttr<AttrVal>;
    removeHoverBgColor?: FormatBreakpointStateAttr<AttrVal>;
    removeHoverBorderColor?: FormatBreakpointStateAttr<AttrVal>;
    removeBorder?: FormatBreakpointStateAttr<BorderValue>;
    removePadding?: FormatBreakpointStateAttr<SpacingValue>;
};

export interface ActiveTagsAttrs extends InternalAttrs {
	module?: {
		meta?: Element.Meta.Attributes;
		advanced?: {
			link?: Element.Advanced.Link.Attributes;
			htmlAttributes?: Element.Advanced.IdClasses.Attributes;
			text?: Element.Advanced.Text.Attributes;
		};
        decoration?: BaseDecoration & DecorationExtras;
	};

	[key: string]: any;
}

export type ActiveTagsEditProps = ModuleEditProps<ActiveTagsAttrs>;
