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

const initialValues = {
    
    
    name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    node_type: 'sfu',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    region: 'us',
    
    
    
    
    
    
    
    zone: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    endpoint: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    health_status: 'healthy',
    
    
    
    
    
    
    
    
    
    
    
    
    last_heartbeat_at: '',
    
    
    
    
    
    
    
    
    
    
    cpu_utilization: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    memory_utilization: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    current_conferences: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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









































  <FormField label="NodeType" labelFor="node_type">
      <Field name="node_type" id="node_type" component="select">
      
        <option value="sfu">sfu</option>
      
        <option value="turn">turn</option>
      
        <option value="signaling_gateway">signaling_gateway</option>
      
        <option value="recorder_worker">recorder_worker</option>
      
        <option value="ai_service">ai_service</option>
      
        <option value="edge_cache">edge_cache</option>
      
      </Field>
  </FormField>



























  <FormField label="Region" labelFor="region">
      <Field name="region" id="region" component="select">
      
        <option value="us">us</option>
      
        <option value="eu">eu</option>
      
        <option value="apac">apac</option>
      
        <option value="sa">sa</option>
      
        <option value="me">me</option>
      
      </Field>
  </FormField>













  <FormField
      label="Zone"
  >
      <Field
          name="zone"
          placeholder="Zone"
      />
  </FormField>



























  <FormField
      label="Endpoint"
  >
      <Field
          name="endpoint"
          placeholder="Endpoint"
      />
  </FormField>









































  <FormField label="HealthStatus" labelFor="health_status">
      <Field name="health_status" id="health_status" component="select">
      
        <option value="healthy">healthy</option>
      
        <option value="degraded">degraded</option>
      
        <option value="unhealthy">unhealthy</option>
      
        <option value="draining">draining</option>
      
        <option value="offline">offline</option>
      
      </Field>
  </FormField>























  <FormField
      label="LastHeartbeatAt"
  >
      <Field
          type="datetime-local"
          name="last_heartbeat_at"
          placeholder="LastHeartbeatAt"
      />
  </FormField>























    <FormField
        label="CPUUtilization"
    >
        <Field
            type="number"
            name="cpu_utilization"
            placeholder="CPUUtilization"
        />
    </FormField>



























    <FormField
        label="MemoryUtilization"
    >
        <Field
            type="number"
            name="memory_utilization"
            placeholder="MemoryUtilization"
        />
    </FormField>



























    <FormField
        label="CurrentConferences"
    >
        <Field
            type="number"
            name="current_conferences"
            placeholder="CurrentConferences"
        />
    </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('/conference_nodes/conference_nodes-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Conference_nodesNew
