type RatingSize = 'small' | 'medium' | 'large';

const SIZE_MAP: Record<RatingSize, number> = {
  small: 18,
  medium: 24,
  large: 30,
};

export const getValidMax = (max?: number | null): number => {
  return Math.max(max || 5, 1);
};

export const getValidSize = (size?: RatingSize): number => {
  return SIZE_MAP[size || 'medium'];
};

export const getNumericValue = (
  value?: number | null,
): number | null | undefined => {
  if (value === undefined || value === null) {
    return value;
  }
  return Number(value);
};
