//------------------------------------------------------------------------------
// <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 GameShopData struct {
    Shopid int32
    Tab int32
    Shopname string
    UpperShop string
    Needshow []*Gameatn
    Rtype int32
    Rtime int32
    Rnum int32
    Rneed []*Gameatn
    Shopitem []int32
}

const TypeId_GameShopData = 1787452988

func (*GameShopData) GetTypeId() int32 {
    return 1787452988
}

func (_v *GameShopData)Deserialize(_buf map[string]interface{}) (err error) {
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["shopid"].(float64); !_ok_ { err = errors.New("shopid error"); return }; _v.Shopid = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["tab"].(float64); !_ok_ { err = errors.New("tab error"); return }; _v.Tab = int32(_tempNum_) }
    {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["shopname"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Shopname error"); return };  { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Shopname, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
    {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["upper_shop"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.UpperShop error"); return };  { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.UpperShop, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["needshow"].([]interface{}); !_ok_ { err = errors.New("needshow error"); return }

                _v.Needshow = 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.Needshow = append(_v.Needshow, _list_v_)
                }
            }

    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["rtype"].(float64); !_ok_ { err = errors.New("rtype error"); return }; _v.Rtype = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["rtime"].(float64); !_ok_ { err = errors.New("rtime error"); return }; _v.Rtime = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["rnum"].(float64); !_ok_ { err = errors.New("rnum error"); return }; _v.Rnum = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["rneed"].([]interface{}); !_ok_ { err = errors.New("rneed error"); return }

                _v.Rneed = 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.Rneed = append(_v.Rneed, _list_v_)
                }
            }

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

                _v.Shopitem = make([]int32, 0, len(_arr_))
                
                for _, _e_ := range _arr_ {
                    var _list_v_ int32
                    { var _ok_ bool; var _x_ float64; if _x_, _ok_ = _e_.(float64); !_ok_ { err = errors.New("_list_v_ error"); return }; _list_v_ = int32(_x_) }
                    _v.Shopitem = append(_v.Shopitem, _list_v_)
                }
            }

    return
}

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