// Divi dependencies.
import { ModuleEditProps } from '@divi/module-library';
import {
	FormatBreakpointStateAttr,
	InternalAttrs,
	type Element,
} from '@divi/types';
import type {
	AttrVal,
	BorderValue,
	SpacingValue,
	TypographyValue,
} 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 = {
	metaAlignment?: FormatBreakpointStateAttr<AttrVal>;
	itemTypography?: FormatBreakpointStateAttr<TypographyValue>;
	itemBgColor?: FormatBreakpointStateAttr<AttrVal>;
	itemColor?: FormatBreakpointStateAttr<AttrVal>;
	itemBgColorHover?: FormatBreakpointStateAttr<AttrVal>;
	itemColorHover?: FormatBreakpointStateAttr<AttrVal>;
	itemHoverBorderColor?: FormatBreakpointStateAttr<AttrVal>;
	itemSpacing?: FormatBreakpointStateAttr<SpacingValue>;
	itemBorder?: FormatBreakpointStateAttr<BorderValue>;
	iconColor?: FormatBreakpointStateAttr<AttrVal>;
	iconSize?: FormatBreakpointStateAttr<AttrVal>;
	iconGap?: FormatBreakpointStateAttr<AttrVal>;
	itemValBgColor?: FormatBreakpointStateAttr<AttrVal>;
	itemValColor?: FormatBreakpointStateAttr<AttrVal>;
	itemValBgColorHover?: FormatBreakpointStateAttr<AttrVal>;
	itemValColorHover?: FormatBreakpointStateAttr<AttrVal>;
	itemValHoverBorderColor?: FormatBreakpointStateAttr<AttrVal>;
	itemValSpacing?: FormatBreakpointStateAttr<SpacingValue>;
	itemValBorder?: FormatBreakpointStateAttr<BorderValue>;
	prefixLGap?: FormatBreakpointStateAttr<AttrVal>;
	prefixRGap?: FormatBreakpointStateAttr<AttrVal>;
	suffixLGap?: FormatBreakpointStateAttr<AttrVal>;
	suffixRGap?: FormatBreakpointStateAttr<AttrVal>;
};

export interface DynamicMetaAttrs 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 DynamicMetaEditProps = ModuleEditProps<DynamicMetaAttrs>;
