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

const initialValues = {
    
    
    name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    model_type: 'anomaly_detection',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'draft',
    
    
    
    
    
    
    
    version: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    framework: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    artifact_uri: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    threshold: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    trained_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    activated_at: '',
    
    
    
    
    
    
    
    
    
    
    
    description: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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









































  <FormField label="ModelType" labelFor="model_type">
      <Field name="model_type" id="model_type" component="select">
      
        <option value="anomaly_detection">anomaly_detection</option>
      
        <option value="malware_detection">malware_detection</option>
      
        <option value="phishing_detection">phishing_detection</option>
      
        <option value="ransomware_detection">ransomware_detection</option>
      
        <option value="risk_scoring">risk_scoring</option>
      
        <option value="recommendation">recommendation</option>
      
        <option value="soc_agent_policy">soc_agent_policy</option>
      
      </Field>
  </FormField>



























  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="draft">draft</option>
      
        <option value="staging">staging</option>
      
        <option value="active">active</option>
      
        <option value="deprecated">deprecated</option>
      
      </Field>
  </FormField>













  <FormField
      label="Version"
  >
      <Field
          name="version"
          placeholder="Version"
      />
  </FormField>



























  <FormField
      label="Framework"
  >
      <Field
          name="framework"
          placeholder="Framework"
      />
  </FormField>



























  <FormField
      label="ArtifactURI"
  >
      <Field
          name="artifact_uri"
          placeholder="ArtifactURI"
      />
  </FormField>

































    <FormField
        label="Threshold"
    >
        <Field
            type="number"
            name="threshold"
            placeholder="Threshold"
        />
    </FormField>































  <FormField
      label="TrainedAt"
  >
      <Field
          type="datetime-local"
          name="trained_at"
          placeholder="TrainedAt"
      />
  </FormField>



























  <FormField
      label="ActivatedAt"
  >
      <Field
          type="datetime-local"
          name="activated_at"
          placeholder="ActivatedAt"
      />
  </FormField>



















    <FormField label="Description" hasTextareaHeight>
        <Field name="description" as="textarea" placeholder="Description" />
    </FormField>











































  <FormField label="organizations" labelFor="organizations">
      <Field name="organizations" id="organizations" component={SelectField} options={[]} itemRef={'organizations'}></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_models/ai_models-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Ai_modelsNew
