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 MoralFormProps = {
  control?: Control;
  defaultValues?: IdeaObject;
  isReadOnly?: boolean;
};

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

  const { t } = useTranslation();

  return (
    <>
      <TextFieldControl
        name="impactedTeams"
        label={t('IDEA_IMPACT')}
        control={control}
        defaultValue={defaultValues ? defaultValues.impactedTeams : ''}
        isReadOnly={isReadOnly}
        isRequired
      />
      <TextFieldControl
        name="investment"
        label={t('INVESTMENT')}
        placeholder={t('RESOURCES_USED')}
        control={control}
        defaultValue={defaultValues ? defaultValues.investment : ''}
        isReadOnly={isReadOnly}
        isRequired
      />
      <TextFieldControl
        name="improvedStandards"
        label={t('STANDARD_IMPROVE')}
        placeholder={t('STANDARD_CHANGE')}
        control={control}
        defaultValue={defaultValues ? defaultValues.improvedStandards : ''}
        isReadOnly={isReadOnly}
        isRequired
      />
    </>
  );
};

export default MoralForm;
