import { forwardRef } from 'react';
import { Select, SelectProps } from '../Select';

import countries from './countries.json';

const options = countries.map((c) => ({ value: c.code, label: c.name }));

export const SelectCountry = forwardRef<HTMLSelectElement, SelectProps>(
  ({ placeholder = 'Country', ...props }, ref) => {
    return (
      <Select
        name="country"
        options={options}
        placeholder={placeholder}
        {...props}
        ref={ref}
      />
    );
  }
);

export default SelectCountry;
