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/knowledge_documents/knowledge_documentsSlice'
import { useAppDispatch } from '../../stores/hooks'
import { useRouter } from 'next/router'
import moment from 'moment';

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    knowledge_source: '',
    
    
    
    
    document_title: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    ingestion_status: 'queued',
    
    
    
    
    
    
    
    language: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    published_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    ingested_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    document_summary: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    tags_csv: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/knowledge_documents/knowledge_documents-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="KnowledgeSource" labelFor="knowledge_source">
      <Field name="knowledge_source" id="knowledge_source" component={SelectField} options={[]} itemRef={'knowledge_sources'}></Field>
  </FormField>









  <FormField
      label="DocumentTitle"
  >
      <Field
          name="document_title"
          placeholder="DocumentTitle"
      />
  </FormField>









































  <FormField label="IngestionStatus" labelFor="ingestion_status">
      <Field name="ingestion_status" id="ingestion_status" component="select">
      
        <option value="queued">queued</option>
      
        <option value="processing">processing</option>
      
        <option value="completed">completed</option>
      
        <option value="failed">failed</option>
      
        <option value="needs_review">needs_review</option>
      
      </Field>
  </FormField>













  <FormField
      label="Language"
  >
      <Field
          name="language"
          placeholder="Language"
      />
  </FormField>





































  <FormField
      label="PublishedAt"
  >
      <Field
          type="datetime-local"
          name="published_at"
          placeholder="PublishedAt"
      />
  </FormField>



























  <FormField
      label="IngestedAt"
  >
      <Field
          type="datetime-local"
          name="ingested_at"
          placeholder="IngestedAt"
      />
  </FormField>





















      <FormField label='DocumentSummary' hasTextareaHeight>
          <Field
              name='document_summary'
              id='document_summary'
              component={RichTextField}
          ></Field>
      </FormField>























  <FormField
      label="TagsCsv"
  >
      <Field
          name="tags_csv"
          placeholder="TagsCsv"
      />
  </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('/knowledge_documents/knowledge_documents-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Knowledge_documentsNew
