<template>
  <div>
    <UiForm :model="Parameters" :entity="parameters">
      <v-row>
        <v-col cols="12">
          <UiInputText
            v-model="parameters.smsSenderName"
            field="smsSenderName"
          />
        </v-col>
        <v-col cols="12">
          <UiInputText
            v-model="parameters.usernameSMS"
            field="usernameSMS"
            label="Nom d'utilisateur SMS"
          />
        </v-col>
        <v-col cols="12">
          <UiInputText
              v-model="parameters.passwordSMS"
              field="passwordSMS"
              type="password"
          />
        </v-col>
      </v-row>
    </UiForm>
  </div>
</template>
<script setup lang="ts">
import Parameters from '~/models/Organization/Parameters'
import { useEntityFetch } from '~/composables/data/useEntityFetch'
import { useOrganizationProfileStore } from '~/stores/organizationProfile'
import { AsyncData } from '#app'

const { fetch } = useEntityFetch()

const organizationProfile = useOrganizationProfileStore()

if (organizationProfile.parametersId === null) {
  throw new Error('Missing organization parameters id')
}

const { data: parameters, pending } = fetch(
  Parameters,
  organizationProfile.parametersId
) as AsyncData<Parameters, Parameters | true>
</script>
