import { mdiAccount, mdiChartTimelineVariant, mdiMail, mdiUpload } from '@mdi/js'
import Head from 'next/head'
import React, { ReactElement } from 'react'
import CardBox from '../../components/CardBox'
import LayoutAuthenticated from '../../layouts/Authenticated'
import SectionMain from '../../components/SectionMain'
import SectionTitleLineWithButton from '../../components/SectionTitleLineWithButton'
import { getPageTitle } from '../../config'

import { Field, Form, Formik } from 'formik'
import FormField from '../../components/FormField'
import BaseDivider from '../../components/BaseDivider'
import BaseButtons from '../../components/BaseButtons'
import BaseButton from '../../components/BaseButton'
import FormCheckRadio from '../../components/FormCheckRadio'
import FormCheckRadioGroup from '../../components/FormCheckRadioGroup'
import FormFilePicker from '../../components/FormFilePicker'
import FormImagePicker from '../../components/FormImagePicker'
import { SwitchField } from '../../components/SwitchField'

import { SelectField } from '../../components/SelectField'
import { SelectFieldMany } from "../../components/SelectFieldMany";
import {RichTextField} from "../../components/RichTextField";

import { create } from '../../stores/map_edges/map_edgesSlice'
import { useAppDispatch } from '../../stores/hooks'
import { useRouter } from 'next/router'
import moment from 'moment';

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    mind_map: '',
    
    
    
    
    from_node_key: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    to_node_key: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    relation_type: 'supports',
    
    
    
    
    
    
    
    
    
    reasoning: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    strength: 'weak',
    
    
    
    
    
    
    
    
    
    
    
    
    
    ai_generated: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


const Map_edgesNew = () => {
  const router = useRouter()
  const dispatch = useAppDispatch()

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/map_edges/map_edges-list')
  }
  return (
    <>
      <Head>
        <title>{getPageTitle('New Item')}</title>
      </Head>
      <SectionMain>
        <SectionTitleLineWithButton icon={mdiChartTimelineVariant} title="New Item" main>
        {''}
        </SectionTitleLineWithButton>
        <CardBox>
          <Formik
            initialValues={
                
                initialValues
                
            }
            onSubmit={(values) => handleSubmit(values)}
          >
            <Form>





















  <FormField label="MindMap" labelFor="mind_map">
      <Field name="mind_map" id="mind_map" component={SelectField} options={[]} itemRef={'mind_maps'}></Field>
  </FormField>









  <FormField
      label="FromNodeKey"
  >
      <Field
          name="from_node_key"
          placeholder="FromNodeKey"
      />
  </FormField>



























  <FormField
      label="ToNodeKey"
  >
      <Field
          name="to_node_key"
          placeholder="ToNodeKey"
      />
  </FormField>









































  <FormField label="RelationType" labelFor="relation_type">
      <Field name="relation_type" id="relation_type" component="select">
      
        <option value="supports">supports</option>
      
        <option value="causes">causes</option>
      
        <option value="enables">enables</option>
      
        <option value="depends_on">depends_on</option>
      
        <option value="contradicts">contradicts</option>
      
        <option value="validates">validates</option>
      
        <option value="mitigates">mitigates</option>
      
        <option value="implements">implements</option>
      
        <option value="precedes">precedes</option>
      
        <option value="related_to">related_to</option>
      
      </Field>
  </FormField>

















      <FormField label='Reasoning' hasTextareaHeight>
          <Field
              name='reasoning'
              id='reasoning'
              component={RichTextField}
          ></Field>
      </FormField>





































  <FormField label="Strength" labelFor="strength">
      <Field name="strength" id="strength" component="select">
      
        <option value="weak">weak</option>
      
        <option value="medium">medium</option>
      
        <option value="strong">strong</option>
      
      </Field>
  </FormField>





























  <FormField label='AIGenerated' labelFor='ai_generated'>
      <Field
          name='ai_generated'
          id='ai_generated'
          component={SwitchField}
      ></Field>
  </FormField>





























  <FormField label="organizations" labelFor="organizations">
      <Field name="organizations" id="organizations" component={SelectField} options={[]} itemRef={'organizations'}></Field>
  </FormField>







              <BaseDivider />
              <BaseButtons>
                <BaseButton type="submit" color="info" label="Submit" />
                <BaseButton type="reset" color="info" outline label="Reset" />
                <BaseButton type='reset' color='danger' outline label='Cancel' onClick={() => router.push('/map_edges/map_edges-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

Map_edgesNew.getLayout = function getLayout(page: ReactElement) {
  return (
      <LayoutAuthenticated
        
          permission={'CREATE_MAP_EDGES'}
        
      >
          {page}
      </LayoutAuthenticated>
  )
}

export default Map_edgesNew
