// 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 = {
	itemsDirection?: FormatBreakpointStateAttr<AttrVal>;
	itemsAlignment?: FormatBreakpointStateAttr<AttrVal>;
	generalTypography?: FormatBreakpointStateAttr<TypographyValue>;
	itemColor?: FormatBreakpointStateAttr<AttrVal>;
	itemBackgroundColor?: FormatBreakpointStateAttr<AttrVal>;
	itemColorHover?: FormatBreakpointStateAttr<AttrVal>;
	itemBackgroundColorHover?: FormatBreakpointStateAttr<AttrVal>;
	itemBorderColorHover?: FormatBreakpointStateAttr<AttrVal>;
	itemBorder?: FormatBreakpointStateAttr<BorderValue>;
	itemSpacing?: FormatBreakpointStateAttr<SpacingValue>;
	delimiterTypography?: FormatBreakpointStateAttr<TypographyValue>;
	delimiterColor?: FormatBreakpointStateAttr<AttrVal>;
	delimiterMargin?: FormatBreakpointStateAttr<SpacingValue>;
	counterItemColor?: FormatBreakpointStateAttr<AttrVal>;
	counterItemTypography?: FormatBreakpointStateAttr<TypographyValue>;
	counterItemBackgroundColor?: FormatBreakpointStateAttr<AttrVal>;
	counterItemBorder?: FormatBreakpointStateAttr<BorderValue>;
	counterItemMargin?: FormatBreakpointStateAttr<SpacingValue>;
	counterItemDepth?: FormatBreakpointStateAttr<AttrVal>;
	counterSelfAlign?: FormatBreakpointStateAttr<AttrVal>;
};

export interface DynamicRepeaterAttrs 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 DynamicRepeaterEditProps = ModuleEditProps<DynamicRepeaterAttrs>;
