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

const initialValues = {
    
    
    
    
    
    
    
    
    
    
    
    
    
    workspace: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    project: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    song: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    requested_user: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    model: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    request_type: 'generate_beat_from_text',
    
    
    
    
    
    
    
    
    
    prompt_text: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    input_asset: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    target_genre: '',
    
    
    
    
    
    
    
    target_bpm: '',
    
    
    
    
    
    
    
    
    
    
    
    
    target_key: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    mood: 'happy',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'queued',
    
    
    
    
    
    
    
    
    
    
    
    
    queued_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    started_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    finished_at: '',
    
    
    
    
    
    
    
    
    
    
    
    error_message: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    compute_seconds: '',
    
    
    
    
    
    
    
    
    
    
    
    
    estimated_cost: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    output_asset: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    organizations: '',
    
    
    
}


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

    
    

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



























  <FormField label="Project" labelFor="project">
      <Field name="project" id="project" component={SelectField} options={[]} itemRef={'projects'}></Field>
  </FormField>



























  <FormField label="Song" labelFor="song">
      <Field name="song" id="song" component={SelectField} options={[]} itemRef={'songs'}></Field>
  </FormField>



























  <FormField label="RequestedBy" labelFor="requested_user">
      <Field name="requested_user" id="requested_user" component={SelectField} options={[]} itemRef={'users'}></Field>
  </FormField>



























  <FormField label="AIModel" labelFor="model">
      <Field name="model" id="model" component={SelectField} options={[]} itemRef={'ai_models'}></Field>
  </FormField>























  <FormField label="RequestType" labelFor="request_type">
      <Field name="request_type" id="request_type" component="select">
      
        <option value="generate_beat_from_text">generate_beat_from_text</option>
      
        <option value="generate_beat_from_vocals">generate_beat_from_vocals</option>
      
        <option value="arrangement_builder">arrangement_builder</option>
      
        <option value="vocal_processing">vocal_processing</option>
      
        <option value="auto_mix">auto_mix</option>
      
        <option value="mastering">mastering</option>
      
        <option value="cover_art">cover_art</option>
      
        <option value="song_naming">song_naming</option>
      
        <option value="metadata_tagging">metadata_tagging</option>
      
        <option value="genre_suggestion">genre_suggestion</option>
      
        <option value="make_it_amapiano">make_it_amapiano</option>
      
      </Field>
  </FormField>

















      <FormField label='PromptText' hasTextareaHeight>
          <Field
              name='prompt_text'
              id='prompt_text'
              component={RichTextField}
          ></Field>
      </FormField>









































  <FormField label="InputAsset" labelFor="input_asset">
      <Field name="input_asset" id="input_asset" component={SelectField} options={[]} itemRef={'assets'}></Field>
  </FormField>



























  <FormField label="TargetGenre" labelFor="target_genre">
      <Field name="target_genre" id="target_genre" component={SelectField} options={[]} itemRef={'genres'}></Field>
  </FormField>















    <FormField
        label="TargetBPM"
    >
        <Field
            type="number"
            name="target_bpm"
            placeholder="TargetBPM"
        />
    </FormField>





















  <FormField
      label="TargetKey"
  >
      <Field
          name="target_key"
          placeholder="TargetKey"
      />
  </FormField>









































  <FormField label="Mood" labelFor="mood">
      <Field name="mood" id="mood" component="select">
      
        <option value="happy">happy</option>
      
        <option value="sad">sad</option>
      
        <option value="spiritual">spiritual</option>
      
        <option value="energetic">energetic</option>
      
        <option value="romantic">romantic</option>
      
        <option value="chill">chill</option>
      
        <option value="aggressive">aggressive</option>
      
      </Field>
  </FormField>



























  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="queued">queued</option>
      
        <option value="running">running</option>
      
        <option value="succeeded">succeeded</option>
      
        <option value="failed">failed</option>
      
        <option value="canceled">canceled</option>
      
      </Field>
  </FormField>























  <FormField
      label="QueuedAt"
  >
      <Field
          type="datetime-local"
          name="queued_at"
          placeholder="QueuedAt"
      />
  </FormField>



























  <FormField
      label="StartedAt"
  >
      <Field
          type="datetime-local"
          name="started_at"
          placeholder="StartedAt"
      />
  </FormField>



























  <FormField
      label="FinishedAt"
  >
      <Field
          type="datetime-local"
          name="finished_at"
          placeholder="FinishedAt"
      />
  </FormField>



















    <FormField label="ErrorMessage" hasTextareaHeight>
        <Field name="error_message" as="textarea" placeholder="ErrorMessage" />
    </FormField>































    <FormField
        label="ComputeSeconds"
    >
        <Field
            type="number"
            name="compute_seconds"
            placeholder="ComputeSeconds"
        />
    </FormField>



























    <FormField
        label="EstimatedCost"
    >
        <Field
            type="number"
            name="estimated_cost"
            placeholder="EstimatedCost"
        />
    </FormField>







































  <FormField label="OutputAsset" labelFor="output_asset">
      <Field name="output_asset" id="output_asset" component={SelectField} options={[]} itemRef={'assets'}></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('/generation_requests/generation_requests-list')}/>
              </BaseButtons>
            </Form>
          </Formik>
        </CardBox>
      </SectionMain>
    </>
  )
}

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

export default Generation_requestsNew
