//------------------------------------------------------------------------------
// <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 GameCaravanCityData struct {
    Id int32
    Citylink []int32
    Cityticket []*Gameatn
    Cityexlock []int32
    Citylvlock int32
    Citymainlock int32
    Cityman int32
    Cityname string
    Cityinformation string
    Citytxt string
    Citytype int32
    Citytypenum int32
    Special []int32
    Specialnum int32
    Exspecial []int32
    Exspecialnum int32
    Orspecial int32
    Checktime int32
    Extalk int32
    Ortalk int32
    Sptalk int32
    Buytalk int32
    Cityeventpro int32
    Cityevent []int32
}

const TypeId_GameCaravanCityData = 145138895

func (*GameCaravanCityData) GetTypeId() int32 {
    return 145138895
}

func (_v *GameCaravanCityData)Deserialize(_buf map[string]interface{}) (err error) {
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["id"].(float64); !_ok_ { err = errors.New("id error"); return }; _v.Id = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["citylink"].([]interface{}); !_ok_ { err = errors.New("citylink error"); return }

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

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

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

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

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

    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["citylvlock"].(float64); !_ok_ { err = errors.New("citylvlock error"); return }; _v.Citylvlock = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["citymainlock"].(float64); !_ok_ { err = errors.New("citymainlock error"); return }; _v.Citymainlock = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["cityman"].(float64); !_ok_ { err = errors.New("cityman error"); return }; _v.Cityman = int32(_tempNum_) }
    {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["cityname"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Cityname error"); return };  { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Cityname, _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["cityinformation"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Cityinformation error"); return };  { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Cityinformation, _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["citytxt"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Citytxt error"); return };  { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Citytxt, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["citytype"].(float64); !_ok_ { err = errors.New("citytype error"); return }; _v.Citytype = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["citytypenum"].(float64); !_ok_ { err = errors.New("citytypenum error"); return }; _v.Citytypenum = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["special"].([]interface{}); !_ok_ { err = errors.New("special error"); return }

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

    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["specialnum"].(float64); !_ok_ { err = errors.New("specialnum error"); return }; _v.Specialnum = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["exspecial"].([]interface{}); !_ok_ { err = errors.New("exspecial error"); return }

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

    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["exspecialnum"].(float64); !_ok_ { err = errors.New("exspecialnum error"); return }; _v.Exspecialnum = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["Orspecial"].(float64); !_ok_ { err = errors.New("Orspecial error"); return }; _v.Orspecial = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["checktime"].(float64); !_ok_ { err = errors.New("checktime error"); return }; _v.Checktime = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["extalk"].(float64); !_ok_ { err = errors.New("extalk error"); return }; _v.Extalk = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["ortalk"].(float64); !_ok_ { err = errors.New("ortalk error"); return }; _v.Ortalk = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["sptalk"].(float64); !_ok_ { err = errors.New("sptalk error"); return }; _v.Sptalk = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["buytalk"].(float64); !_ok_ { err = errors.New("buytalk error"); return }; _v.Buytalk = int32(_tempNum_) }
    { var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["cityeventpro"].(float64); !_ok_ { err = errors.New("cityeventpro error"); return }; _v.Cityeventpro = int32(_tempNum_) }
     {
                var _arr_ []interface{}
                var _ok_ bool
                if _arr_, _ok_ = _buf["cityevent"].([]interface{}); !_ok_ { err = errors.New("cityevent error"); return }

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

    return
}

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