import { defineStore } from 'pinia'
import { ref, reactive } from 'vue'

export const useAppUserRoleStore = defineStore('appUserRoleStore', () => {
  const appUserRoles = ref<Record<string, any>[]>([])
  const appUserRoleBaseForm = reactive<Record<string, any>>({
    gorevAdi: '',
    appUsers: []
  })
  const appUserRoleForm = reactive<Record<string, any>>({})
  const appUserRoleSafeForm = reactive<Record<string, any>>({})
  const isUpdate = ref<boolean>(false)
  const refreshList = ref<boolean>(false)
  const rolePanel = ref<boolean>(false)

  const ResetForm = () => {
    Object.assign(appUserRoleForm, appUserRoleBaseForm)
  }

  return {
    appUserRoles,
    appUserRoleBaseForm,
    appUserRoleForm,
    appUserRoleSafeForm,
    isUpdate,
    refreshList,
    rolePanel,
    ResetForm
  }
})
