local this = {}

function this:init()
  this.super.init(self)
  self.data = {
    allSnackBag = {}
  }
end

function this:getSnackBag(snackBagType)
  return self.data.allSnackBag[snackBagType]
end

function this:getSnackBagSlot(snackType, slotId)
  local snackBag = self:getSnackBag(snackType)
  if snackBag == nil or snackBag.items == nil then
    return {}
  end
  return snackBag.items[slotId] or {}
end

function this:getIsSnackBagSlotEmpty(snackType, slotId)
  local snackBag = self:getSnackBag(snackType)
  if snackBag == nil or snackBag.items == nil then
    return true
  end
  return math.isEmpty(snackBag.items[slotId].item_id)
end

function this:getSnackBagThreshold(snackType)
  local snackBag = self:getSnackBag(snackType)
  if snackBag == nil then
    if snackType == L_Const.snackBagType.hero then
      return L_GameTpl:getGameConstTpl():getValue("SATIETY_AUTOMATIC_USE_ROLE", true)
    elseif snackType == L_Const.snackBagType.mount then
      return L_GameTpl:getGameConstTpl():getValue("SATIETY_AUTOMATIC_USE_MOUNT", true)
    end
    return 0
  end
  return snackBag.num
end

return this
