local CollectionManager = class("CollectionManager", BaseModule)

-- 请求领取英雄图鉴点数
function CollectionManager:reqHeroPoint(id)
    self:sendMessage(ProtoMsgType.FromMsgEnum.HeroCollectionPointReq, {hero_id = id}, {}, self.rspHeroPoint)
end

function CollectionManager:rspHeroPoint(result)
    if result.err_code == GConst.ERROR_STR.SUCCESS then
        DataManager.CollectionData:onGetedPointSuccess(GConst.CollectionConst.TYPE.HERO, result.reqData.hero_id, result.point)
        EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.COLLECTION_GET_POINT_SUCCESS)
    end
end

-- 请求领取皮肤图鉴点数
function CollectionManager:reqSkinPoint(id)
    self:sendMessage(ProtoMsgType.FromMsgEnum.SkinCollectionPointReq, {skin_id = id}, {}, self.rspSkinPoint)
end

function CollectionManager:rspSkinPoint(result)
    if result.err_code == GConst.ERROR_STR.SUCCESS then
        DataManager.CollectionData:onGetedPointSuccess(GConst.CollectionConst.TYPE.SKIN, result.reqData.skin_id, result.point)
        EventManager:dispatchEvent(EventManager.CUSTOM_EVENT.COLLECTION_GET_POINT_SUCCESS)
    end
end

-- 请求领取图鉴奖励
function CollectionManager:reqPointReward()
    self:sendMessage(ProtoMsgType.FromMsgEnum.CollectionUpgradeReq, {}, {}, self.rspPointReward, BIReport.ITEM_GET_TYPE.COLLECTION_HERO_REWARD)
end

function CollectionManager:rspPointReward(result)
    if result.err_code == GConst.ERROR_STR.SUCCESS then
        GFunc.showRewardBox(result.rewards)
        DataManager.CollectionData:onGetedPointRewardSuccess()
    end
end

return CollectionManager