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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    generation_type: 'meal_plan',
    
    
    
    
    
    
    
    
    
    
    
    
    generated_at: '',
    
    
    
    
    
    
    
    
    
    
    
    prompt_context_json: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    result_json: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status_message: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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























  <FormField label="GenerationType" labelFor="generation_type">
      <Field name="generation_type" id="generation_type" component="select">
      
        <option value="meal_plan">meal_plan</option>
      
        <option value="training_program">training_program</option>
      
        <option value="blood_test_interpretation">blood_test_interpretation</option>
      
        <option value="supplement_recommendation">supplement_recommendation</option>
      
        <option value="supplement_interaction_check">supplement_interaction_check</option>
      
        <option value="drug_interaction_check">drug_interaction_check</option>
      
        <option value="correlation_insight">correlation_insight</option>
      
        <option value="daily_insight">daily_insight</option>
      
        <option value="pre_appointment_checklist">pre_appointment_checklist</option>
      
        <option value="symptom_checker">symptom_checker</option>
      
        <option value="recipe_import">recipe_import</option>
      
      </Field>
  </FormField>























  <FormField
      label="GeneratedAt"
  >
      <Field
          type="datetime-local"
          name="generated_at"
          placeholder="GeneratedAt"
      />
  </FormField>



















    <FormField label="PromptContextJSON" hasTextareaHeight>
        <Field name="prompt_context_json" as="textarea" placeholder="PromptContextJSON" />
    </FormField>



























    <FormField label="ResultJSON" hasTextareaHeight>
        <Field name="result_json" as="textarea" placeholder="ResultJSON" />
    </FormField>

























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

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

export default Ai_generationsNew
