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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    theme_mode: 'light',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    font_size: 'small',
    
    
    
    
    
    
    
    
    
    
    
    
    
    high_contrast_mode: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    reduce_motion: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    color_blind_mode: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    voice_input_enabled: false,
    
    
    
    
    
    
    
    
    
    
    
    
    auto_lock_minutes: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    biometric_lock_enabled: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    incognito_mode_enabled: false,
    
    
    
    
    
    
    
    
    
    
    anthropic_api_key_encrypted: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
}


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

    
    

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























  <FormField label="Theme" labelFor="theme_mode">
      <Field name="theme_mode" id="theme_mode" component="select">
      
        <option value="light">light</option>
      
        <option value="dark">dark</option>
      
        <option value="system">system</option>
      
      </Field>
  </FormField>



























  <FormField label="FontSize" labelFor="font_size">
      <Field name="font_size" id="font_size" component="select">
      
        <option value="small">small</option>
      
        <option value="medium">medium</option>
      
        <option value="large">large</option>
      
        <option value="extra_large">extra_large</option>
      
      </Field>
  </FormField>





























  <FormField label='HighContrastMode' labelFor='high_contrast_mode'>
      <Field
          name='high_contrast_mode'
          id='high_contrast_mode'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='ReduceMotion' labelFor='reduce_motion'>
      <Field
          name='reduce_motion'
          id='reduce_motion'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='ColorBlindFriendlyMode' labelFor='color_blind_mode'>
      <Field
          name='color_blind_mode'
          id='color_blind_mode'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='VoiceInputEnabled' labelFor='voice_input_enabled'>
      <Field
          name='voice_input_enabled'
          id='voice_input_enabled'
          component={SwitchField}
      ></Field>
  </FormField>

















    <FormField
        label="AutoLock(minutes)"
    >
        <Field
            type="number"
            name="auto_lock_minutes"
            placeholder="AutoLock(minutes)"
        />
    </FormField>





































  <FormField label='BiometricLockEnabled' labelFor='biometric_lock_enabled'>
      <Field
          name='biometric_lock_enabled'
          id='biometric_lock_enabled'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='IncognitoModeEnabled' labelFor='incognito_mode_enabled'>
      <Field
          name='incognito_mode_enabled'
          id='incognito_mode_enabled'
          component={SwitchField}
      ></Field>
  </FormField>













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

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

export default App_settingsNew
