import React, { createContext } from 'react';

/**
 * Context for passing props to the SelectInputTriggerButton component.
 */
export interface SelectInputTriggerButtonPropsContextValue {
  ref?: React.ForwardedRef<HTMLButtonElement | null>;
  id?: string;
  onClick?: (event: React.MouseEvent) => void;
  onKeyDown?: (event: React.KeyboardEvent) => void;
  size?: 'sm' | 'md' | 'lg';
  [key: string]: unknown;
}

/**
 * Context for passing props to the SelectInputTriggerButton component.
 */
export const SelectInputTriggerButtonPropsContext =
  createContext<SelectInputTriggerButtonPropsContextValue>({});

/**
 * Context for providing the total count of items in a SelectInput.
 * Used for ARIA accessibility to inform screen readers about the total number of options.
 */
export const SelectInputItemsCountContext = createContext<number | undefined>(undefined);

/**
 * Context for providing the current item position in a SelectInput.
 * Used for ARIA accessibility to inform screen readers about the position of the option.
 */
export const SelectInputItemPositionContext = createContext<number | undefined>(undefined);

/**
 * Context indicating whether an option's content is rendered within the trigger button.
 * When true, certain styling adjustments are applied to make the content fit better in the trigger.
 */
export const SelectInputOptionContentWithinTriggerContext = createContext(false);

// Re-export types from the original contexts module for backward compatibility
export type { WithInputAttributesProps } from '../contexts';
