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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    provider: '',
    
    
    
    
    name: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    model_code: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    max_input_tokens: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    max_output_tokens: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    supports_vision: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    supports_function_calling: false,
    
    
    
    
    
    
    
    
    
    price_per_million_input_tokens: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    price_per_million_output_tokens: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    is_active: false,
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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









  <FormField
      label="ModelName"
  >
      <Field
          name="name"
          placeholder="ModelName"
      />
  </FormField>



























  <FormField
      label="ModelCode"
  >
      <Field
          name="model_code"
          placeholder="ModelCode"
      />
  </FormField>

































    <FormField
        label="MaxInputTokens"
    >
        <Field
            type="number"
            name="max_input_tokens"
            placeholder="MaxInputTokens"
        />
    </FormField>



























    <FormField
        label="MaxOutputTokens"
    >
        <Field
            type="number"
            name="max_output_tokens"
            placeholder="MaxOutputTokens"
        />
    </FormField>





































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



























  <FormField label='SupportsFunctionCalling' labelFor='supports_function_calling'>
      <Field
          name='supports_function_calling'
          id='supports_function_calling'
          component={SwitchField}
      ></Field>
  </FormField>

















    <FormField
        label="PricePerMillionInputTokens"
    >
        <Field
            type="number"
            name="price_per_million_input_tokens"
            placeholder="PricePerMillionInputTokens"
        />
    </FormField>



























    <FormField
        label="PricePerMillionOutputTokens"
    >
        <Field
            type="number"
            name="price_per_million_output_tokens"
            placeholder="PricePerMillionOutputTokens"
        />
    </FormField>





































  <FormField label='IsActive' labelFor='is_active'>
      <Field
          name='is_active'
          id='is_active'
          component={SwitchField}
      ></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('/llm_models/llm_models-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Llm_modelsNew
