import React, { ReactNode } from 'react';

import { TextFieldPropsColorOverrides, TextFieldPropsSizeOverrides } from '@mui/material/TextField';
import { FormHelperTextProps, InputBaseProps, InputLabelProps, OutlinedInputProps, SelectProps, SxProps, Theme } from '@mui/material';
import { InputProps as StandardInputProps } from '@mui/material/Input';
import { OverridableStringUnion } from '@mui/types';
import { TextField } from '@mui/material';
import { TextFieldColorVariant, MuiTextFieldBaseProps, TextFieldSizeVariant, TextFieldVariant } from '../types';

export interface TextFieldBaseProps extends MuiTextFieldBaseProps {
  id?: string;
  name?: string;
  defaultValue?: string;
  disabled?: boolean;
  required?: boolean;
  type?: React.InputHTMLAttributes<unknown>['type'];
  hasError?: boolean;
  label?: ReactNode;
  children?: ReactNode;
  error?: boolean;
  variant?: TextFieldVariant;
  helperText?: React.ReactNode;
  InputLabelProps?: Partial<InputLabelProps>;
  InputProps?: Partial<OutlinedInputProps>;
  autoComplete?: string;
  placeholder?: string;
  multiline?: boolean;
  rows?: string | number;
  maxRows?: string | number;
  minRows?: string | number;
  select?: boolean;
  SelectProps?: Partial<SelectProps>;
  onChange?: OutlinedInputProps['onChange'];
  onClick?: InputBaseProps['onClick'];
  onBlur?: InputBaseProps['onBlur'];
  onFocus?: StandardInputProps['onFocus'];
  size?: OverridableStringUnion<TextFieldSizeVariant, TextFieldPropsSizeOverrides>;
  FormHelperTextProps?: Partial<FormHelperTextProps>;
  color?: OverridableStringUnion<TextFieldColorVariant, TextFieldPropsColorOverrides>;
  value?: unknown;
  sx?: SxProps<Theme> | undefined
}

export type TextFieldType = keyof typeof TextField;
