//------------------------------------------------------------------------------
// <auto-generated>
//     This code was generated by a tool.
//     Changes to this file may cause incorrect behavior and will be lost if
//     the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

package cfg

import "errors"

type GameRechargeData struct {
    Id string
    Editionid string
    RechargeType int32
    Monetaryunit string
    Amount int32
    Vipexp []*Gameatn
    DiamondNumDouble []*Gameatn
    Channel string
    Text string
    Image string
}

const TypeId_GameRechargeData = -1686494355

func (*GameRechargeData) GetTypeId() int32 {
    return -1686494355
}

func (_v *GameRechargeData)Deserialize(_buf map[string]interface{}) (err error) {
    { var _ok_ bool; if _v.Id, _ok_ = _buf["id"].(string); !_ok_ { err = errors.New("id error"); return } }
    { var _ok_ bool; if _v.Editionid, _ok_ = _buf["editionid"].(string); !_ok_ { err = errors.New("editionid error"); return } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["recharge_type"].(float64); !_ok_ { err = errors.New("recharge_type error"); return }; _v.RechargeType = int32(_tempNum_) }
    { var _ok_ bool; if _v.Monetaryunit, _ok_ = _buf["monetaryunit"].(string); !_ok_ { err = errors.New("monetaryunit error"); return } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["amount"].(float64); !_ok_ { err = errors.New("amount error"); return }; _v.Amount = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["vipexp"].([]interface{}); !_ok_ { err = errors.New("vipexp error"); return }

                _v.Vipexp = make([]*Gameatn, 0, len(_arr_))
                
                for _, _e_ := range _arr_ {
                    var _list_v_ *Gameatn
                    { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
                    _v.Vipexp = append(_v.Vipexp, _list_v_)
                }
            }

     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["diamond_num_double"].([]interface{}); !_ok_ { err = errors.New("diamond_num_double error"); return }

                _v.DiamondNumDouble = make([]*Gameatn, 0, len(_arr_))
                
                for _, _e_ := range _arr_ {
                    var _list_v_ *Gameatn
                    { var _ok_ bool; var _x_ map[string]interface{}; if _x_, _ok_ = _e_.(map[string]interface{}); !_ok_ { err = errors.New("_list_v_ error"); return }; if _list_v_, err = DeserializeGameatn(_x_); err != nil { return } }
                    _v.DiamondNumDouble = append(_v.DiamondNumDouble, _list_v_)
                }
            }

    { var _ok_ bool; if _v.Channel, _ok_ = _buf["channel"].(string); !_ok_ { err = errors.New("channel error"); return } }
    { var _ok_ bool; if _v.Text, _ok_ = _buf["text"].(string); !_ok_ { err = errors.New("text error"); return } }
    { var _ok_ bool; if _v.Image, _ok_ = _buf["image"].(string); !_ok_ { err = errors.New("image error"); return } }
    return
}

func DeserializeGameRechargeData(_buf map[string]interface{}) (*GameRechargeData, error) {
    v := &GameRechargeData{}
    if err := v.Deserialize(_buf); err == nil {
        return v, nil
    } else {
        return nil, err
    }
}
