local ModData = {}

function ModData.ensureBCRoot(item)
    if not item or not item.getModData then return nil end

    local md = item:getModData()
    if not md.BetterCooking then
        md.BetterCooking = {}
    end
    return md.BetterCooking
end

function ModData.updateButcheredMeat(item, token)
    local root = ModData.ensureBCRoot(item)
    if not root then return end

    root.meatQuality = token
end

function ModData.getBCRoot(item)
    if not item or not item.getModData then return nil end

    local md = item:getModData()
    return md.BetterCooking
end

function ModData.getMeatQuality(item)
    local root = ModData.getBCRoot(item)
    if not root then return nil end
    return root.meatQuality
end

return ModData