// Divi dependencies.
import { ModuleEditProps } from '@divi/module-library';
import {
	InternalAttrs,
	FormatBreakpointStateAttr,
	type Element,
} 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 = {
	contentInputWidth?: FormatBreakpointStateAttr<AttrVal>;
	contentLineHorizontalAlignment?: FormatBreakpointStateAttr<AttrVal>;
	contentLineVerticalAlignment?: FormatBreakpointStateAttr<AttrVal>;
	inputTypography?: FormatBreakpointStateAttr<TypographyValue>;
	inputColor?: FormatBreakpointStateAttr<AttrVal>;
	inputBackgroundColor?: FormatBreakpointStateAttr<AttrVal>;
	inputBorder?: FormatBreakpointStateAttr<BorderValue>;
	inputSpacing?: FormatBreakpointStateAttr<SpacingValue>;
	inputPadding?: FormatBreakpointStateAttr<SpacingValue>;
	inputMargin?: FormatBreakpointStateAttr<SpacingValue>;
	labelTypography?: FormatBreakpointStateAttr<TypographyValue>;
	labelAlignment?: FormatBreakpointStateAttr<AttrVal>;
	labelColor?: FormatBreakpointStateAttr<AttrVal>;
	labelSpacing?: FormatBreakpointStateAttr<SpacingValue>;
	labelPadding?: FormatBreakpointStateAttr<SpacingValue>;
	labelMargin?: FormatBreakpointStateAttr<SpacingValue>;
	buttonNormalColor?: FormatBreakpointStateAttr<AttrVal>;
	buttonNormalBgColor?: FormatBreakpointStateAttr<AttrVal>;
	buttonHoverColor?: FormatBreakpointStateAttr<AttrVal>;
	buttonHoverBgColor?: FormatBreakpointStateAttr<AttrVal>;
	buttonHoverBorderColor?: FormatBreakpointStateAttr<AttrVal>;
	buttonBorder?: FormatBreakpointStateAttr<BorderValue>;
	buttonSpacing?: FormatBreakpointStateAttr<SpacingValue>;
	buttonPadding?: FormatBreakpointStateAttr<SpacingValue>;
	buttonMargin?: FormatBreakpointStateAttr<SpacingValue>;
	buttonAlignment?: FormatBreakpointStateAttr<AttrVal>;
};

export interface SearchAttrs 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 SearchEditProps = ModuleEditProps<SearchAttrs>;
