// Divi dependencies.
import { ModuleEditProps } from '@divi/module-library';
import {
  FormatBreakpointStateAttr,
  InternalAttrs,
  type Element,
} from '@divi/types';

import type {
  AttrVal,
  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 = {
  horizontalGap?: FormatBreakpointStateAttr<AttrVal>;
  verticalGap?: FormatBreakpointStateAttr<AttrVal>;
  collapseFirstLastGap?: FormatBreakpointStateAttr<AttrVal>;
  loaderColor?: FormatBreakpointStateAttr<AttrVal>;
  loaderSize?: FormatBreakpointStateAttr<AttrVal>;
  loaderTextColor?: FormatBreakpointStateAttr<AttrVal>;
  loaderTextTypography?: FormatBreakpointStateAttr<TypographyValue>;
  centerModePadding?: FormatBreakpointStateAttr<AttrVal>;
  arrowsBoxSize?: FormatBreakpointStateAttr<AttrVal>;
  arrowsSize?: FormatBreakpointStateAttr<AttrVal>;
  arrowsZIndex?: FormatBreakpointStateAttr<AttrVal>;
  arrowColor?: FormatBreakpointStateAttr<AttrVal>;
  arrowBgColor?: FormatBreakpointStateAttr<AttrVal>;
  arrowColorHover?: FormatBreakpointStateAttr<AttrVal>;
  arrowBgColorHover?: FormatBreakpointStateAttr<AttrVal>;
  dotsSize?: FormatBreakpointStateAttr<AttrVal>;
  dotsGap?: FormatBreakpointStateAttr<AttrVal>;
  dotsBgColor?: FormatBreakpointStateAttr<AttrVal>;
  dotsBgColorHover?: FormatBreakpointStateAttr<AttrVal>;
  dotsBgColorActive?: FormatBreakpointStateAttr<AttrVal>;
  notFoundTypography?: FormatBreakpointStateAttr<TypographyValue>;
  notFoundColor?: FormatBreakpointStateAttr<AttrVal>;
};

export interface ListingGridAttrs 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 ListingGridEditProps = ModuleEditProps<ListingGridAttrs>;
