class_name ItemAction

class ItemDialogueState:
  var item_name:String
  var quantity:int
  func _init(itemName:String, qty:int) -> void:
    item_name = itemName
    quantity = qty

static func itemGetCallable(params:Dictionary) -> int:
  assert(params.has('stack'))
  var stack:ItemStack = params['stack']
  PARTY.BACKPACK.addStack(stack)

  var state = ItemDialogueState.new(Item.getItemName(stack.item), stack.quantity)
  var dialogueParams:Dictionary = DialogueAction.getDialogueCallable(
    "res://dialogue/item/pickup",
    "start",
    [state],
    DialogueAction.DialogueMode.CONVERSATION
  )
  dialogueParams['position'] = Cutscene.CUTSCENE_ADD_NEXT
  params['cutscene'].addCallable(dialogueParams)
  return Cutscene.CUTSCENE_CONTINUE

static func getItemCallable(itemStack:ItemStack) -> Dictionary:
  return {
    'function': itemGetCallable,
    'stack': itemStack,
  }
