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 = {
    selectWidth?: FormatBreakpointStateAttr<AttrVal>;

    hierarchicalPosition?: FormatBreakpointStateAttr<AttrVal>;
    hierarchicalVerticalOffset?: FormatBreakpointStateAttr<AttrVal>;
    hierarchicalItemWidth?: FormatBreakpointStateAttr<AttrVal>;
    hierarchicalHorizontalOffset?: FormatBreakpointStateAttr<AttrVal>;

    selectTypography?: FormatBreakpointStateAttr<TypographyValue>;
    selectColor?: FormatBreakpointStateAttr<AttrVal>;
    selectDisabledColor?: FormatBreakpointStateAttr<AttrVal>;
    selectBgColor?: FormatBreakpointStateAttr<AttrVal>;
    selectBorder?: FormatBreakpointStateAttr<BorderValue>;
    selectSpacing?: FormatBreakpointStateAttr<SpacingValue>;

    labelTypography?: FormatBreakpointStateAttr<TypographyValue>;
    labelAlignment?: FormatBreakpointStateAttr<AttrVal>;
    labelColor?: FormatBreakpointStateAttr<AttrVal>;
    labelSpacing?: FormatBreakpointStateAttr<SpacingValue>;

    buttonTypography?: FormatBreakpointStateAttr<TypographyValue>;
    buttonTextColor?: FormatBreakpointStateAttr<AttrVal>;
    buttonBgColor?: FormatBreakpointStateAttr<AttrVal>;
    buttonHoverTextColor?: FormatBreakpointStateAttr<AttrVal>;
    buttonHoverBgColor?: FormatBreakpointStateAttr<AttrVal>;
    buttonHoverBorderColor?: FormatBreakpointStateAttr<AttrVal>;
    buttonBorder?: FormatBreakpointStateAttr<BorderValue>;
    buttonSpacing?: FormatBreakpointStateAttr<SpacingValue>;
    buttonAlignment?: FormatBreakpointStateAttr<AttrVal>;
};

export interface SelectFilterAttrs 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 SelectFilterEditProps = ModuleEditProps<SelectFilterAttrs>;