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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    organization: '',
    
    
    
    
    template_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    workflow_type: 'joiner',
    
    
    
    
    
    
    
    
    description: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    risk_level: 'low',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    owner_role: 'org_admin',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    source_trigger_type: 'HR',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    recurrence_type: 'none',
    
    
    
    
    
    
    
    
    default_required_fields: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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









































  <FormField label="WorkflowType" labelFor="workflow_type">
      <Field name="workflow_type" id="workflow_type" component="select">
      
        <option value="joiner">joiner</option>
      
        <option value="mover">mover</option>
      
        <option value="leaver">leaver</option>
      
        <option value="privileged_access_assignment">privileged_access_assignment</option>
      
        <option value="privileged_access_removal">privileged_access_removal</option>
      
        <option value="mfa_enforcement">mfa_enforcement</option>
      
        <option value="quarterly_access_review">quarterly_access_review</option>
      
        <option value="service_account_review">service_account_review</option>
      
        <option value="break_glass_exception">break_glass_exception</option>
      
        <option value="emergency_access_use">emergency_access_use</option>
      
      </Field>
  </FormField>















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







































  <FormField label="RiskLevel" labelFor="risk_level">
      <Field name="risk_level" id="risk_level" component="select">
      
        <option value="low">low</option>
      
        <option value="medium">medium</option>
      
        <option value="high">high</option>
      
        <option value="critical">critical</option>
      
      </Field>
  </FormField>



























  <FormField label="OwnerRole" labelFor="owner_role">
      <Field name="owner_role" id="owner_role" component="select">
      
        <option value="org_admin">org_admin</option>
      
        <option value="compliance_manager">compliance_manager</option>
      
        <option value="security_manager">security_manager</option>
      
        <option value="iam_operator">iam_operator</option>
      
        <option value="auditor">auditor</option>
      
        <option value="read_only_client">read_only_client</option>
      
      </Field>
  </FormField>



























  <FormField label="SourceTriggerType" labelFor="source_trigger_type">
      <Field name="source_trigger_type" id="source_trigger_type" component="select">
      
        <option value="HR">HR</option>
      
        <option value="Ticket">Ticket</option>
      
        <option value="Manual">Manual</option>
      
        <option value="Automated">Automated</option>
      
        <option value="Scheduled">Scheduled</option>
      
      </Field>
  </FormField>



























  <FormField label="RecurrenceType" labelFor="recurrence_type">
      <Field name="recurrence_type" id="recurrence_type" component="select">
      
        <option value="none">none</option>
      
        <option value="weekly">weekly</option>
      
        <option value="monthly">monthly</option>
      
        <option value="quarterly">quarterly</option>
      
        <option value="semi_annual">semi_annual</option>
      
        <option value="annual">annual</option>
      
      </Field>
  </FormField>















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

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

export default Workflow_templatesNew
