// 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 = {
	termsAlignment?: FormatBreakpointStateAttr<AttrVal>;
	linkTypography?: FormatBreakpointStateAttr<TypographyValue>;
	linkBg?: FormatBreakpointStateAttr<AttrVal>;
	linkColor?: FormatBreakpointStateAttr<AttrVal>;
	linkBgHover?: FormatBreakpointStateAttr<AttrVal>;
	linkColorHover?: FormatBreakpointStateAttr<AttrVal>;
	linkHoverBorderColor?: FormatBreakpointStateAttr<AttrVal>;
	linkSpacing?: FormatBreakpointStateAttr<SpacingValue>;
	linkBorder?: FormatBreakpointStateAttr<BorderValue>;
	iconColor?: FormatBreakpointStateAttr<AttrVal>;
	iconSize?: FormatBreakpointStateAttr<AttrVal>;
	iconGap?: FormatBreakpointStateAttr<AttrVal>;
	delimiterColor?: FormatBreakpointStateAttr<AttrVal>;
	delimiterSize?: FormatBreakpointStateAttr<AttrVal>;
	delimiterLGap?: FormatBreakpointStateAttr<AttrVal>;
	delimiterRGap?: FormatBreakpointStateAttr<AttrVal>;
	prefixTypography?: FormatBreakpointStateAttr<TypographyValue>;
	prefixColor?: FormatBreakpointStateAttr<AttrVal>;
	prefixGap?: FormatBreakpointStateAttr<AttrVal>;
	suffixTypography?: FormatBreakpointStateAttr<TypographyValue>;
	suffixColor?: FormatBreakpointStateAttr<AttrVal>;
	suffixGap?: FormatBreakpointStateAttr<AttrVal>;
};

export interface DynamicTermsAttrs 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 DynamicTermsEditProps = ModuleEditProps<DynamicTermsAttrs>;
