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

const initialValues = {
    
    
    scenario_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    scenario_type: 'mock_campaign',
    
    
    
    
    
    
    
    
    
    scenario_description: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    campaign_brain_config: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    safety_policy: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'draft',
    
    
    
    
    
    
    
    
    
    
    
    
    last_run_at: '',
    
    
    
    
    
    
    
    
    
}


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

    
    

  const handleSubmit = async (data) => {
    await dispatch(create(data))
    await router.push('/sandbox_scenarios/sandbox_scenarios-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="ScenarioName"
  >
      <Field
          name="scenario_name"
          placeholder="ScenarioName"
      />
  </FormField>









































  <FormField label="ScenarioType" labelFor="scenario_type">
      <Field name="scenario_type" id="scenario_type" component="select">
      
        <option value="mock_campaign">mock_campaign</option>
      
        <option value="mock_client_call">mock_client_call</option>
      
        <option value="policy_stress_test">policy_stress_test</option>
      
        <option value="competitor_teardown">competitor_teardown</option>
      
        <option value="compliance_drill">compliance_drill</option>
      
        <option value="prompt_regression">prompt_regression</option>
      
      </Field>
  </FormField>

















      <FormField label='ScenarioDescription' hasTextareaHeight>
          <Field
              name='scenario_description'
              id='scenario_description'
              component={RichTextField}
          ></Field>
      </FormField>









































  <FormField label="CampaignBrainConfig" labelFor="campaign_brain_config">
      <Field name="campaign_brain_config" id="campaign_brain_config" component={SelectField} options={[]} itemRef={'campaign_brain_configs'}></Field>
  </FormField>



























  <FormField label="SafetyPolicy" labelFor="safety_policy">
      <Field name="safety_policy" id="safety_policy" component={SelectField} options={[]} itemRef={'safety_policies'}></Field>
  </FormField>























  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="draft">draft</option>
      
        <option value="running">running</option>
      
        <option value="completed">completed</option>
      
        <option value="approved">approved</option>
      
        <option value="rejected">rejected</option>
      
      </Field>
  </FormField>























  <FormField
      label="LastRunAt"
  >
      <Field
          type="datetime-local"
          name="last_run_at"
          placeholder="LastRunAt"
      />
  </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('/sandbox_scenarios/sandbox_scenarios-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Sandbox_scenariosNew
