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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    ai_insight_run: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    category: 'pattern',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    severity: 'info',
    
    
    
    
    
    
    
    title: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    detail: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    related_trades: [],
    
    
}


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

    
    

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























  <FormField label="Category" labelFor="category">
      <Field name="category" id="category" component="select">
      
        <option value="pattern">pattern</option>
      
        <option value="weakness">weakness</option>
      
        <option value="edge">edge</option>
      
        <option value="tip">tip</option>
      
        <option value="alert">alert</option>
      
        <option value="sizing">sizing</option>
      
        <option value="market_condition">market_condition</option>
      
        <option value="summary">summary</option>
      
      </Field>
  </FormField>



























  <FormField label="Severity" labelFor="severity">
      <Field name="severity" id="severity" component="select">
      
        <option value="info">info</option>
      
        <option value="low">low</option>
      
        <option value="medium">medium</option>
      
        <option value="high">high</option>
      
      </Field>
  </FormField>













  <FormField
      label="Title"
  >
      <Field
          name="title"
          placeholder="Title"
      />
  </FormField>





























    <FormField label="Detail" hasTextareaHeight>
        <Field name="detail" as="textarea" placeholder="Detail" />
    </FormField>













































    <FormField label='RelatedTrades' labelFor='related_trades'>
        <Field
            name='related_trades'
            id='related_trades'
            itemRef={'trades'}
            options={[]}
            component={SelectFieldMany}>
        </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('/ai_insight_items/ai_insight_items-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Ai_insight_itemsNew
