import { ref } from 'vue'
import { defineStore } from 'pinia'
import type { Tile, Object } from '@/types'

export const useAssetManagerStore = defineStore('assetManager', () => {
  const tileList = ref<Tile[]>([])
  const selectedTile = ref<Tile | null>(null)

  const objectList = ref<Object[]>([])
  const selectedObject = ref<Object | null>(null)

  function setTileList(tiles: Tile[]) {
    tileList.value = tiles
  }

  function setObjectList(objects: Object[]) {
    objectList.value = objects
  }

  function setSelectedTile(tile: Tile | null) {
    selectedTile.value = tile
  }

  function setSelectedObject(object: Object | null) {
    selectedObject.value = object
  }

  return {
    tileList,
    objectList,
    setTileList,
    setObjectList,
    selectedTile,
    selectedObject,
    setSelectedTile,
    setSelectedObject
  }
})
