import { defineStore } from 'pinia'
import { ref, reactive } from 'vue'
import { usePiyangoStore } from './piyangoStore'

export const usePiyangoCekilisTutanagiStore = defineStore('piyangoCekilisTutanagiStore', () => {
  const piyangoStore = usePiyangoStore()

  const cekilisTutanagiList = ref<Record<string, any>[]>([])
  const cekilisTutanagiBaseForm = reactive<Record<string, any>>({
    dosya: null,
    cekilisId: piyangoStore.selectedLottery,
    dokumanAdi: ''
  })
  const cekilisTutanagiForm = reactive<Record<string, any>>({})
  const cekilisTutanagiSafeForm = reactive<Record<string, any>>({})
  const isUpdate = ref<boolean>(false)
  const refreshList = ref<boolean>(false)
  const documentPanel = ref<boolean>(false)
  const loaded = ref<boolean>(false)

  const ResetForm = () => {
    Object.assign(cekilisTutanagiForm, cekilisTutanagiBaseForm)
  }
  
  return {
    cekilisTutanagiList,
    cekilisTutanagiBaseForm,
    cekilisTutanagiForm,
    cekilisTutanagiSafeForm,
    isUpdate,
    refreshList,
    documentPanel,
    loaded,
    ResetForm
  }
})

