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 = {
    
    
    display_name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    provider: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    model_key: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    capability_class: 'chat',
    
    
    
    
    
    
    
    
    
    
    max_context_tokens: '',
    
    
    
    
    
    
    
    
    
    
    
    
    input_cost_per_1k: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    output_cost_per_1k: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    supports_streaming: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    supports_function_calls: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    supports_vision: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'active',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    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="DisplayName"
  >
      <Field
          name="display_name"
          placeholder="DisplayName"
      />
  </FormField>



























  <FormField
      label="Provider"
  >
      <Field
          name="provider"
          placeholder="Provider"
      />
  </FormField>



























  <FormField
      label="ModelKey"
  >
      <Field
          name="model_key"
          placeholder="ModelKey"
      />
  </FormField>









































  <FormField label="CapabilityClass" labelFor="capability_class">
      <Field name="capability_class" id="capability_class" component="select">
      
        <option value="chat">chat</option>
      
        <option value="code">code</option>
      
        <option value="vision">vision</option>
      
        <option value="tools">tools</option>
      
        <option value="reasoning">reasoning</option>
      
      </Field>
  </FormField>



















    <FormField
        label="MaxContextTokens"
    >
        <Field
            type="number"
            name="max_context_tokens"
            placeholder="MaxContextTokens"
        />
    </FormField>



























    <FormField
        label="InputCostPer1K"
    >
        <Field
            type="number"
            name="input_cost_per_1k"
            placeholder="InputCostPer1K"
        />
    </FormField>



























    <FormField
        label="OutputCostPer1K"
    >
        <Field
            type="number"
            name="output_cost_per_1k"
            placeholder="OutputCostPer1K"
        />
    </FormField>





































  <FormField label='SupportsStreaming' labelFor='supports_streaming'>
      <Field
          name='supports_streaming'
          id='supports_streaming'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='SupportsFunctionCalls' labelFor='supports_function_calls'>
      <Field
          name='supports_function_calls'
          id='supports_function_calls'
          component={SwitchField}
      ></Field>
  </FormField>



























  <FormField label='SupportsVision' labelFor='supports_vision'>
      <Field
          name='supports_vision'
          id='supports_vision'
          component={SwitchField}
      ></Field>
  </FormField>

























  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="active">active</option>
      
        <option value="deprecated">deprecated</option>
      
        <option value="disabled">disabled</option>
      
      </Field>
  </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
