"use client";

import { OptionSelect } from "@/components/app/option-select";
import type { Locale } from "@/lib/locales";

/** Select pays ou langue : la valeur est toujours l'un des codes de `options`. */
export function LocaleSelect({
  id,
  label,
  options,
  value,
  onValueChange,
  className,
}: {
  id: string;
  label: string;
  options: Locale[];
  value: string;
  onValueChange: (value: string) => void;
  className?: string;
}) {
  return (
    <OptionSelect
      id={id}
      label={label}
      options={options.map((option) => ({ value: option.code, label: option.label }))}
      value={value}
      onValueChange={onValueChange}
      className={className}
    />
  );
}
