 
 import UIKit
 
+import ObjectMapper
 
 /// 话题的 账号模型
-class User: NSObject {
+class User: Mappable {
     
     var user_id: String?  /// 用户id
     var nickname: String? /// 用户昵称

    var pics: [[String: AnyObject]]?
    var channel: [String: AnyObject]?
    var video: [String: AnyObject]?
}



/// 首页轮播图对应的模型
class Banner: NSObject {
    
    var id: String?
    var title: String?

    var photo_height: String?
    var is_show_icon: Bool = false
    
    required init?(map: Map){}
    
    func mapping(map: Map) {
        id <- map["id"]
        title <- map["title"]
        sub_title <- map["sub_title"]
        type <- map["type"]
        topic_type <- map["topic_type"]
        photo <- map["photo"]
        extend <- map["extend"]
        browser_url <- map["browser_url"]
        index <- map["index"]
        parent_id <- map["parent_id"]
        photo_width <- map["photo_width"]
        photo_height <- map["photo_height"]
        is_show_icon <- map["is_show_icon"]
    }
}


class HomeData: Mappable {
    
    class InsertElement: Mappable {
        
        var  index: Double = 0
        var element_list: [Banner]?
        
        required init?(map: Map){}
        func mapping(map: Map) {
            index <- map["index"]
            element_list <- map["element_list"]
        }
    }
    
    
    
    var topic: [Topic]?
    var append_extend: [String: AnyObject]?
    var banner : [Banner]?
    var category_element: [Banner]?
    var insert_element: [InsertElement]?
    
    required init?(map: Map){}
    
    func mapping(map: Map) {
        topic <- map["topic"]
        append_extend <- map["append_extend"]
        banner <- map["banner"]
        category_element <- map["category_element"]
        insert_element <- map["insert_element"]
    }
}




/// 最终的大模型
class HomePageModel: Mappable {
    
    var status: String?
    var msg: String?
    var ts: Double = 0
    var data :HomeData?
    
    required init?(map: Map){}
    
    func mapping(map: Map) {
        status <- map["status"]
        msg <- map["msg"]
        ts <- map["ts"]
        data <- map["data"]
    }
}










