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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    trading_account: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    run_type: 'daily_summary',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'queued',
    
    
    
    
    
    
    
    
    
    
    
    
    period_start_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    period_end_at: '',
    
    
    
    
    
    
    
    
    
    
    
    prompt_snapshot: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    output_summary: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    consistency_score: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    completed_at: '',
    
    
    
    
    
    
    
    
    
}


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

    
    

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























  <FormField label="RunType" labelFor="run_type">
      <Field name="run_type" id="run_type" component="select">
      
        <option value="daily_summary">daily_summary</option>
      
        <option value="weekly_summary">weekly_summary</option>
      
        <option value="trade_review">trade_review</option>
      
        <option value="pattern_scan">pattern_scan</option>
      
        <option value="risk_sizing">risk_sizing</option>
      
        <option value="market_condition">market_condition</option>
      
      </Field>
  </FormField>



























  <FormField label="Status" labelFor="status">
      <Field name="status" id="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="PeriodStartAt"
  >
      <Field
          type="datetime-local"
          name="period_start_at"
          placeholder="PeriodStartAt"
      />
  </FormField>



























  <FormField
      label="PeriodEndAt"
  >
      <Field
          type="datetime-local"
          name="period_end_at"
          placeholder="PeriodEndAt"
      />
  </FormField>



















    <FormField label="PromptSnapshot" hasTextareaHeight>
        <Field name="prompt_snapshot" as="textarea" placeholder="PromptSnapshot" />
    </FormField>



























    <FormField label="OutputSummary" hasTextareaHeight>
        <Field name="output_summary" as="textarea" placeholder="OutputSummary" />
    </FormField>































    <FormField
        label="ConsistencyScore"
    >
        <Field
            type="number"
            name="consistency_score"
            placeholder="ConsistencyScore"
        />
    </FormField>































  <FormField
      label="CompletedAt"
  >
      <Field
          type="datetime-local"
          name="completed_at"
          placeholder="CompletedAt"
      />
  </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_runs/ai_insight_runs-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Ai_insight_runsNew
