<template>
  <form-input
    v-model="piyangoIkramiyeStore.piyangoIkramiyeForm.cinsi"
    label="Cinsi"
    modelKey="cinsi"
    minlength="2"
    :invalidText="piyangoIkramiyeValidationStore.invalidTexts.cinsi" />
  <form-input
    required
    modelKey="marka"
    v-model="piyangoIkramiyeStore.piyangoIkramiyeForm.marka"
    :invalidText="piyangoIkramiyeValidationStore.invalidTexts.marka"
    label="Marka" />
  <form-input
    modelKey="model"
    v-model="piyangoIkramiyeStore.piyangoIkramiyeForm.model"
    :invalidText="piyangoIkramiyeValidationStore.invalidTexts.model"
    label="Model" />
  <form-input
    required
    half
    modelKey="birimFiyat"
    v-model="piyangoIkramiyeStore.piyangoIkramiyeForm.birimFiyat"
    :invalidText="piyangoIkramiyeValidationStore.invalidTexts.birimFiyat"
    label="KDV+ÖTV Dahil Birim Değeri"
    @keydown="validationStore.allowPrice"
    @keyup="piyangoIkramiyeStore.CalculateToplamDeger" />
  <form-select
    label="Para Birimi"
    half
    :listData="piyangoDataStore.paraBirimleri"
    listVal="id"
    listText="paraBirimiSembol"
    v-model="piyangoIkramiyeStore.piyangoIkramiyeForm.paraBirimiId"
    required
    :invalidText="piyangoIkramiyeValidationStore.invalidTexts.paraBirimiId" />
  <form-input
    required
    modelKey="asilTalihliAdedi"
    v-model="piyangoIkramiyeStore.piyangoIkramiyeForm.asilTalihliAdedi"
    :invalidText="piyangoIkramiyeValidationStore.invalidTexts.asilTalihliAdedi"
    :label="piyangoStore.isLotteryForCharity ? 'Talihli Adedi' : 'Asıl Talihli Adedi'"
    @keydown="validationStore.allowNumbersWithKeys"
    @keyup="piyangoIkramiyeStore.CalculateToplamDeger" />
  <form-input
    v-if="!piyangoStore.isLotteryForCharity"
    required
    modelKey="yedekTalihliAdedi"
    v-model="piyangoIkramiyeStore.piyangoIkramiyeForm.yedekTalihliAdedi"
    :invalidText="piyangoIkramiyeValidationStore.invalidTexts.yedekTalihliAdedi"
    label="Yedek Talihli Adedi"
    @keydown="validationStore.allowNumbersWithKeys" />
  <form-input
    disabled
    modelKey="toplamDeger"
    v-model="piyangoIkramiyeStore.piyangoIkramiyeForm.toplamDeger"
    label="Toplam Değer" />
</template>
<script setup lang="ts">
  import { onBeforeMount } from 'vue'
  
  import { useValidationStore } from '@/stores/validationStore'
  const validationStore = useValidationStore()
  import { usePiyangoStore } from '../../stores/piyangoStore'
  const piyangoStore = usePiyangoStore()
  import { usePiyangoDataStore } from '../../stores/piyangoDataStore'
  const piyangoDataStore = usePiyangoDataStore()
  import { usePiyangoServices } from '../../service/piyangoServices'
  const piyangoServices = usePiyangoServices()
  import { usePiyangoIkramiyeStore } from '../../stores/piyangoIkramiyeStore'
  const piyangoIkramiyeStore = usePiyangoIkramiyeStore()
  import { usePiyangoIkramiyeValidationStore } from '../../validation/piyangoIkramiyeValidationStore'
  const piyangoIkramiyeValidationStore = usePiyangoIkramiyeValidationStore()

  onBeforeMount(async () => {
    await piyangoServices.GetParaBirimleri()
  })
</script>
