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

const initialValues = {
    
    
    session_token: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    status: 'active',
    
    
    
    
    
    
    
    
    
    
    starting_lives: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    lives_remaining: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    streak: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    best_streak: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    timer_profile: 'normal',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    mode_selection: 'beatmap_only',
    
    
    
    
    
    
    
    
    
    
    
    
    started_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    ended_at: '',
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    user: '',
    
    
    
}


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

    
    

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









































  <FormField label="Status" labelFor="status">
      <Field name="status" id="status" component="select">
      
        <option value="active">active</option>
      
        <option value="finished">finished</option>
      
        <option value="abandoned">abandoned</option>
      
      </Field>
  </FormField>



















    <FormField
        label="StartingLives"
    >
        <Field
            type="number"
            name="starting_lives"
            placeholder="StartingLives"
        />
    </FormField>



























    <FormField
        label="LivesRemaining"
    >
        <Field
            type="number"
            name="lives_remaining"
            placeholder="LivesRemaining"
        />
    </FormField>



























    <FormField
        label="Streak"
    >
        <Field
            type="number"
            name="streak"
            placeholder="Streak"
        />
    </FormField>



























    <FormField
        label="BestStreak"
    >
        <Field
            type="number"
            name="best_streak"
            placeholder="BestStreak"
        />
    </FormField>



































  <FormField label="TimerProfile" labelFor="timer_profile">
      <Field name="timer_profile" id="timer_profile" component="select">
      
        <option value="normal">normal</option>
      
        <option value="insane">insane</option>
      
      </Field>
  </FormField>



























  <FormField label="ModeSelection" labelFor="mode_selection">
      <Field name="mode_selection" id="mode_selection" component="select">
      
        <option value="beatmap_only">beatmap_only</option>
      
        <option value="mapper_only">mapper_only</option>
      
        <option value="artist_only">artist_only</option>
      
        <option value="mixed">mixed</option>
      
      </Field>
  </FormField>























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



























  <FormField
      label="EndedAt"
  >
      <Field
          type="datetime-local"
          name="ended_at"
          placeholder="EndedAt"
      />
  </FormField>



































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

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

export default Game_sessionsNew
