import {
  INPUT_TYPE_DETAIL_TYPES,
  type UserSelectableInputType,
  type WidgetVariantOption,
  isUserSelectableInputType,
} from "@/types/input-type-mapping";

/** base 가 8개 안에 있을 때만 variant 목록 반환 */
export function getWidgetVariants(baseInputType: string): WidgetVariantOption[] {
  if (!isUserSelectableInputType(baseInputType)) return [];
  return INPUT_TYPE_DETAIL_TYPES[baseInputType as UserSelectableInputType] ?? [];
}

/** base 의 기본 variant 반환 (variant 목록의 첫 번째) */
export function getDefaultWidgetVariant(baseInputType: string): string {
  const variants = getWidgetVariants(baseInputType);
  return variants[0]?.value ?? baseInputType;
}
