import React from 'react';
import { Platform } from 'react-native';
import DatePickerAndroid from './DatePickerAndroid';
import DatePickerCalendar from './DatePickerCalendar';
import DatePickerIOS from './DatePickerIOS';
import type { InternalDatePickerProps } from './types';
import TextInput from '../TextInput';

const DatePicker = ({
  variant = 'default',
  TextInputComponent = TextInput,
  ...props
}: InternalDatePickerProps) => {
  if (variant === 'calendar') {
    return (
      <DatePickerCalendar {...props} TextInputComponent={TextInputComponent} />
    );
  }
  if (Platform.OS === 'ios') {
    return (
      <DatePickerIOS
        {...props}
        variant={variant}
        TextInputComponent={TextInputComponent}
      />
    );
  }

  return (
    <DatePickerAndroid
      {...props}
      variant={variant}
      TextInputComponent={TextInputComponent}
    />
  );
};

export default DatePicker;
