/**
 * Comment node config
 */

import React from 'react';
import type { NodeConfigRendererProps } from './types';

import { useLanguage } from '../../../../providers/language/LanguageContext';

export const CommentNodeConfig: React.FC<NodeConfigRendererProps> = ({ params, updateParam }) => {
  const { t } = useLanguage();
  return (
    <>
      <div>
        <label>Platzhalter</label>
        <input
          value={(params.placeholder as string) ?? ''}
          onChange={(e) => updateParam('placeholder', e.target.value)}
          placeholder={t('commentNodeConfig.kommentarEingeben')}
        />
      </div>
      <div>
        <label>
          <input
            type="checkbox"
            checked={(params.required as boolean) ?? true}
            onChange={(e) => updateParam('required', e.target.checked)}
          />
          Pflichtfeld
        </label>
      </div>
    </>
  );
};
