// 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 = {
    // Stars.
    starsSize?: FormatBreakpointStateAttr<AttrVal>;
    starsGutter?: FormatBreakpointStateAttr<AttrVal>;
    starsColor?: FormatBreakpointStateAttr<AttrVal>;
    starsSelectedColor?: FormatBreakpointStateAttr<AttrVal>;
    starsSelectedHoverColor?: FormatBreakpointStateAttr<AttrVal>;
    starsAlignment?: FormatBreakpointStateAttr<AttrVal>;

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

    // Button.
    buttonTextColor?: FormatBreakpointStateAttr<AttrVal>;
    buttonBgColor?: FormatBreakpointStateAttr<AttrVal>;
    buttonHoverTextColor?: FormatBreakpointStateAttr<AttrVal>;
    buttonHoverBgColor?: FormatBreakpointStateAttr<AttrVal>;
    buttonHoverBorderColor?: FormatBreakpointStateAttr<AttrVal>;
    buttonSpacing?: FormatBreakpointStateAttr<SpacingValue>;
    buttonBorder?: FormatBreakpointStateAttr<BorderValue>;
    buttonAlignment?: FormatBreakpointStateAttr<AttrVal>;
};

export interface RatingFilterAttrs 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 RatingFilterEditProps = ModuleEditProps<RatingFilterAttrs>;