import { Nullable } from '../../types/general';

/**
 * Modes supported by the date picker component.
 */
export type DatePickerModeType = 'single' | 'range';

/**
 * Value type returned by the date picker depending on mode.
 */
export type DatePickerValueType<T extends DatePickerModeType> = T extends 'single'
	? string
	: [string, string];

/**
 * Dropdown configuration options for the date picker.
 */
export type DropdownConfigForDatePicker = {
	/**
	 * Element selector or reference used for positioning.
	 */
	positionRelativeTo?: string;
	/**
	 * Whether the dropdown height is fixed.
	 */
	staticHeight?: boolean;
};

/**
 * Structure representing a month and year.
 */
export type DatePickerMonthYearType = {
	/**
	 * Month label or number as a string.
	 */
	month: string;
	/**
	 * Year value as a string.
	 */
	year: string;
};

/**
 * Single or multiple month/year selections.
 */
export type DatePickerMonthYearTypes = DatePickerMonthYearType | DatePickerMonthYearType[];
/**
 * Position of month when rendering a calendar (start or end).
 */
export type DatePickerCalendarMonthRenderType = 'start' | 'end';

/**
 * Specifies which date is being repicked in range mode.
 */
export type DatePickerCalendarRepickType = 'start' | 'end';

/**
 * Dropdown props used internally by the date picker calendar.
 */
export type VegaDropdownPropsForDatePickerCalendar = Partial<
	Pick<HTMLVegaDropdownElement, 'isScreenPosition'>
>;

/**
 * Size variants for the date picker calendar.
 */
export type DatePickerCalendarSizeType = 'small' | 'regular' | 'large';

/**
 * Indicator function type for calendar dates, returning tooltip properties or null.
 */
export type DatePickerCalendarIndicatorTooltipProps = Partial<
	Pick<HTMLVegaTooltipElement, 'text' | 'size' | 'maxWidth' | 'minWidth' | 'trigger'>
>;

/**
 * Function type for providing date indicators in the calendar, returning tooltip properties or null for a given date.
 */
export type DatePickerCalendarIndicator = (date: Date) => Nullable<DatePickerCalendarIndicatorTooltipProps>;
