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

const initialValues = {
    
    
    task_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    task_type: 'profile_draft',
    
    
    
    
    
    
    
    
    
    
    
    
    
    stores_private_output: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    allowed_for_free_users: false,
    
    
    
    
    
    
    
    
    
    
    
    
    per_user_daily_limit: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    system_prompt_template: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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









































  <FormField label="TaskType" labelFor="task_type">
      <Field name="task_type" id="task_type" component="select">
      
        <option value="profile_draft">profile_draft</option>
      
        <option value="vision_preview">vision_preview</option>
      
        <option value="career_coach_first_contact">career_coach_first_contact</option>
      
        <option value="tutor_in_lesson">tutor_in_lesson</option>
      
        <option value="learning_coach_checkin">learning_coach_checkin</option>
      
        <option value="rubric_spotcheck">rubric_spotcheck</option>
      
        <option value="other">other</option>
      
      </Field>
  </FormField>





























  <FormField label='StoresPrivateOutput' labelFor='stores_private_output'>
      <Field
          name='stores_private_output'
          id='stores_private_output'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='AllowedForFreeUsers' labelFor='allowed_for_free_users'>
      <Field
          name='allowed_for_free_users'
          id='allowed_for_free_users'
          component={SwitchField}
      ></Field>
  </FormField>

















    <FormField
        label="PerUserDailyLimit"
    >
        <Field
            type="number"
            name="per_user_daily_limit"
            placeholder="PerUserDailyLimit"
        />
    </FormField>























    <FormField label="SystemPromptTemplate" hasTextareaHeight>
        <Field name="system_prompt_template" as="textarea" placeholder="SystemPromptTemplate" />
    </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_tasks/ai_tasks-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Ai_tasksNew
