<template>
  <LayoutContainer>
    <div>
      <h2>{{ $t('educationTiming') }}</h2>
      <UiFormEdition
        :model="EducationTiming"
        go-back-route="/parameters/education_timings"
      >
        <template v-slot="{ entity }">
          <UiInputNumber
            field="educationTiming"
            v-model="entity.timing"
            :rules="rules()"
          />
        </template>
      </UiFormEdition>
    </div>
  </LayoutContainer>
</template>
<script setup lang="ts">
import EducationTiming from '~/models/Education/EducationTiming'
import type {RouteLocationPathRaw} from 'vue-router'
import { useI18n } from 'vue-i18n'

const i18n = useI18n()

const rules = () => [
  (timing: string | null) =>
    (timing !== null && parseInt(timing) > 0) || i18n.t('please_enter_a_value'),
]
</script>
