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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    ad_project: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    requested_by: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    run_type: 'generate',
    
    
    
    
    
    
    
    
    
    
    
    
    requested_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    run_status: 'queued',
    
    
    
    
    
    
    
    
    input_prompt: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    model_label: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    temperature: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    retrieved_chunk_count: '',
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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



























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























  <FormField label="RunType" labelFor="run_type">
      <Field name="run_type" id="run_type" component="select">
      
        <option value="generate">generate</option>
      
        <option value="analyze">analyze</option>
      
        <option value="teardown">teardown</option>
      
        <option value="compliance_review">compliance_review</option>
      
        <option value="ab_test_plan">ab_test_plan</option>
      
        <option value="research_summary">research_summary</option>
      
      </Field>
  </FormField>























  <FormField
      label="RequestedAt"
  >
      <Field
          type="datetime-local"
          name="requested_at"
          placeholder="RequestedAt"
      />
  </FormField>































  <FormField label="RunStatus" labelFor="run_status">
      <Field name="run_status" id="run_status" component="select">
      
        <option value="queued">queued</option>
      
        <option value="running">running</option>
      
        <option value="completed">completed</option>
      
        <option value="failed">failed</option>
      
      </Field>
  </FormField>















    <FormField label="InputPrompt" hasTextareaHeight>
        <Field name="input_prompt" as="textarea" placeholder="InputPrompt" />
    </FormField>

























  <FormField
      label="ModelLabel"
  >
      <Field
          name="model_label"
          placeholder="ModelLabel"
      />
  </FormField>

































    <FormField
        label="Temperature"
    >
        <Field
            type="number"
            name="temperature"
            placeholder="Temperature"
        />
    </FormField>



























    <FormField
        label="RetrievedChunkCount"
    >
        <Field
            type="number"
            name="retrieved_chunk_count"
            placeholder="RetrievedChunkCount"
        />
    </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('/generation_runs/generation_runs-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Generation_runsNew
