<template>
  <div>
    <LayoutParametersSection>
      <UiFormCreation
        :model="ResidenceArea"
        go-back-route="/parameters/residence_areas"
      >
        <template #default="{ entity }">
          <v-container :fluid="true" class="container">
            <v-row>
              <v-col cols="12" sm="6">
                <UiInputText
                  v-model="entity.label"
                  field="label"
                  type="string"
                  :rules="rules()"
                />
              </v-col>
            </v-row>
          </v-container>
        </template>
      </UiFormCreation>
    </LayoutParametersSection>
  </div>
</template>

<script setup lang="ts">
import { useI18n } from 'vue-i18n'
import ResidenceArea from '~/models/Billing/ResidenceArea'

definePageMeta({
  name: 'create_a_new_residence_area',
})

const i18n = useI18n()

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