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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    organization: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    workflow: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    control_requirement: '',
    
    
    
    
    
    evidence_claim: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    source_system: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    artifact_type: 'screenshot',
    
    
    
    
    
    
    
    
    required_fields: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    approval_required_flag: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    retention_period: '30_days',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    evidence_strength: 'weak',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    collection_method: 'manual',
    
    
    
    
    
    
    
    
    notes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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



























  <FormField label="Workflow" labelFor="workflow">
      <Field name="workflow" id="workflow" component={SelectField} options={[]} itemRef={'identity_workflows'}></Field>
  </FormField>



























  <FormField label="ControlRequirement" labelFor="control_requirement">
      <Field name="control_requirement" id="control_requirement" component={SelectField} options={[]} itemRef={'control_requirements'}></Field>
  </FormField>











    <FormField label="EvidenceClaim" hasTextareaHeight>
        <Field name="evidence_claim" as="textarea" placeholder="EvidenceClaim" />
    </FormField>











































  <FormField label="SourceSystem" labelFor="source_system">
      <Field name="source_system" id="source_system" component={SelectField} options={[]} itemRef={'connected_systems'}></Field>
  </FormField>























  <FormField label="ArtifactType" labelFor="artifact_type">
      <Field name="artifact_type" id="artifact_type" component="select">
      
        <option value="screenshot">screenshot</option>
      
        <option value="export_csv">export_csv</option>
      
        <option value="export_json">export_json</option>
      
        <option value="audit_log">audit_log</option>
      
        <option value="ticket">ticket</option>
      
        <option value="attestation">attestation</option>
      
        <option value="configuration">configuration</option>
      
        <option value="policy_document">policy_document</option>
      
        <option value="api_snapshot">api_snapshot</option>
      
        <option value="other">other</option>
      
      </Field>
  </FormField>















    <FormField label="RequiredFields" hasTextareaHeight>
        <Field name="required_fields" as="textarea" placeholder="RequiredFields" />
    </FormField>









































  <FormField label='ApprovalRequiredFlag' labelFor='approval_required_flag'>
      <Field
          name='approval_required_flag'
          id='approval_required_flag'
          component={SwitchField}
      ></Field>
  </FormField>

























  <FormField label="RetentionPeriod" labelFor="retention_period">
      <Field name="retention_period" id="retention_period" component="select">
      
        <option value="30_days">30_days</option>
      
        <option value="90_days">90_days</option>
      
        <option value="180_days">180_days</option>
      
        <option value="1_year">1_year</option>
      
        <option value="3_years">3_years</option>
      
        <option value="7_years">7_years</option>
      
        <option value="indefinite">indefinite</option>
      
      </Field>
  </FormField>



























  <FormField label="EvidenceStrength" labelFor="evidence_strength">
      <Field name="evidence_strength" id="evidence_strength" component="select">
      
        <option value="weak">weak</option>
      
        <option value="moderate">moderate</option>
      
        <option value="strong">strong</option>
      
      </Field>
  </FormField>



























  <FormField label="CollectionMethod" labelFor="collection_method">
      <Field name="collection_method" id="collection_method" component="select">
      
        <option value="manual">manual</option>
      
        <option value="api">api</option>
      
        <option value="export">export</option>
      
        <option value="screenshot">screenshot</option>
      
        <option value="ticket">ticket</option>
      
        <option value="log">log</option>
      
        <option value="attestation">attestation</option>
      
      </Field>
  </FormField>















    <FormField label="Notes" hasTextareaHeight>
        <Field name="notes" as="textarea" placeholder="Notes" />
    </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('/evidence_models/evidence_models-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Evidence_modelsNew
