--[[
  -- product
   ["AssetId"] = 0,
    ["AssetTypeId"] = 0,
    ["Created"] = "2023-05-17T18:00:11.7196645Z",
    ["Creator"] =  ▶ {...},
    ["Description"] = "example description",
    ["DisplayDescription"] = "example description",
    ["DisplayIconImageAssetId"] = 0,
    ["DisplayName"] = "developer product test",
    ["IconImageAssetId"] = 0,
    ["IsForSale"] = true,
    ["IsLimited"] = false,
    ["IsLimitedUnique"] = false,
    ["IsNew"] = true,
    ["IsPublicDomain"] = false,
    ["MinimumMembershipLevel"] = 0,
    ["Name"] = "developer product test",
    ["PriceInRobux"] = 1000000000,
    ["ProductId"] = 1543290027,
    ["ProductType"] = "Developer Product",
    ["TargetId"] = 23596539,
    ["Updated"] = "2023-05-17T18:00:42.4963917Z"

  
  --badge
   {
    ["Description"] = "",
    ["IconImageId"] = 11132927395,
    ["IsEnabled"] = false,
    ["Name"] = "Example Badge"
  }
  
  	--BadgeService:GetBadgeInfoAsync()
	--BadgeService:AwardBadge()
	--BadgeService:UserHasBadgeAsync()
	
]]


function module.AwardBadge(userId: number, badgeId: number): boolean?
	local func = Functions.badges[badgeId]
	if not func or BadgeService:UserHasBadgeAsync(userId, badgeId) then return end
	
	local success, result = pcall(func, userId)
	assert(success, `AwardBadge error: {result}`)
	
	if result then
		BadgeService:AwardBadge(userId, badgeId)
	end
	return true
end
