import { Col, Form, Input, Row, Switch } from "antd";
import React from "react";
import { useTranslation } from "react-i18next";
import NotesPresetButton from "../notes-preset-button/notes-preset-button.component";

export default function NoteUpsertModalComponent({ form }) {
  const { t } = useTranslation();

  return (
    <Row gutter={[16, 16]}>
      <Col span={8}>
        <Form.Item
          label={t("notes.fields.critical")}
          name="critical"
          valuePropName="checked"
        >
          <Switch />
        </Form.Item>
      </Col>
      <Col span={8}>
        <Form.Item
          label={t("notes.fields.private")}
          name="private"
          valuePropName="checked"
        >
          <Switch />
        </Form.Item>
      </Col>
      <Col span={8}>
        <NotesPresetButton form={form} />
      </Col>
      <Col span={24}>
        <Form.Item
          label={t("notes.fields.text")}
          name="text"
          rules={[
            {
              required: true,
              message: t("general.validation.required"),
            },
          ]}
        >
          <Input.TextArea
            rows={8}
            placeholder={t("notes.labels.newnoteplaceholder")}
          />
        </Form.Item>
      </Col>
    </Row>
  );
}
