123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import Foundation
- import ObjectMapper
- public enum MessageType: String {
- case thumbup = "thumbup"
- case comment = "comment"
- case system = "system"
- }
- public struct MessageItem: JSONCode {
- public var msg_unread_num = 0
- public var msg_type_desc = ""
- public var msg_type = MessageType.system
- public var msg_avatar = ""
-
- init(json: [String: AnyObject]) {
- self.init(map: Map(mappingType: .fromJSON, JSON: json))
- }
- }
- extension MessageItem: Mappable {
-
- public init(map: Map) {
- mapping(map: map)
- }
-
- public mutating func mapping(map: Map) {
- msg_unread_num <- map["msg_unread_num"]
- msg_type_desc <- map["msg_type_desc"]
- msg_type <- (map["msg_type"], EnumTransform<MessageType>())
- msg_avatar <- map["msg_avatar"]
- }
- }
- extension MessageItem: Equatable {
- public static func == (lhs: MessageItem, rhs: MessageItem) -> Bool {
- return lhs.msg_type == rhs.msg_type
- && lhs.msg_avatar == rhs.msg_avatar
- && lhs.msg_type_desc == rhs.msg_type_desc
- && lhs.msg_unread_num == rhs.msg_unread_num
- }
- }
|