// 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 = {
	applyTypography?: FormatBreakpointStateAttr<TypographyValue>;
	applyNormalColor?: FormatBreakpointStateAttr<AttrVal>;
	applyNormalBgColor?: FormatBreakpointStateAttr<AttrVal>;
	applyHoverColor?: FormatBreakpointStateAttr<AttrVal>;
	applyHoverBgColor?: FormatBreakpointStateAttr<AttrVal>;
	applyHoverBorderColor?: FormatBreakpointStateAttr<AttrVal>;
	applyDisabledOpacity?: FormatBreakpointStateAttr<AttrVal>;
	applyDisabledColor?: FormatBreakpointStateAttr<AttrVal>;
	applyDisabledBgColor?: FormatBreakpointStateAttr<AttrVal>;
	applyDisabledBorderColor?: FormatBreakpointStateAttr<AttrVal>;
	applyBorder?: FormatBreakpointStateAttr<BorderValue>;
	applySpacing?: FormatBreakpointStateAttr<SpacingValue>;
	applyAlignment?: FormatBreakpointStateAttr<AttrVal>;
};

export interface ApplyButtonAttrs 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 ApplyButtonEditProps = ModuleEditProps<ApplyButtonAttrs>;
