import { FC } from 'react';
import { Control } from 'react-hook-form';

import { useTranslation } from 'src/pages/dashboard/recognitions/i18n';
import { IdeaObject } from 'src/types/recognitions';

import TextFieldControl from '../formControls/TextFieldControl';

export type OptimizationFormProps = {
  control?: Control;
  defaultValues?: IdeaObject;
  isReadOnly?: boolean;
};

export const OptimizationForm: FC<OptimizationFormProps> = props => {
  const { control = null, defaultValues = null, isReadOnly = false } = props;

  const { t } = useTranslation();

  return (
    <>
      <TextFieldControl
        name="improvedActivities"
        label={t('ACTIVITIES_IMPROVE')}
        control={control}
        defaultValue={defaultValues ? defaultValues.improvedActivities : ''}
        isReadOnly={isReadOnly}
        isRequired
      />
      <TextFieldControl
        name="personsByShift"
        label={t('PEOPLE_PER_SHIFT')}
        control={control}
        defaultValue={defaultValues ? defaultValues.personsByShift : ''}
        isReadOnly={isReadOnly}
        isRequired
      />
      <TextFieldControl
        name="investment"
        label={t('INVESTMENT')}
        placeholder={t('RESOURCES_USED')}
        control={control}
        defaultValue={defaultValues ? defaultValues.investment : ''}
        isReadOnly={isReadOnly}
        isRequired
      />
    </>
  );
};

export default OptimizationForm;
