//
//	Data.swift
//	Model file Generated using JSONExport: https://github.com/Ahmed-Ali/JSONExport

import Foundation

struct LoginRetData{

	var addrBookSize : Int!
	var allowPush : Int!
	var appState : Int!
	var branch : String!
	var branchID : Int!
	var cid : String!
	var company : String!
	var device : LoginRetDevice!
	var devices : [LoginRetDevice]!
	var displayName : String!
	var duty : String!
	var email : String!
	var enableAccont : Bool!
	var enableMultiSendSms : Bool!
	var enableSendSms : Bool!
	var headImageUrl : String!
	var id : Int!
	var isFirst : Bool!
	var isLocked : Bool!
	var loginName : String!
	var loginState : Int!
	var mainRole : Int!
	var mobile : String!
	var needSMS : Bool!
	var password : String!
	var position : Int!
	var roles : String!
	var secret : Int!
	var serverID : String!
	var sex : Int!
	var shortMobile : AnyObject!
	var tel : AnyObject!
	var timestamp : Int!
	var trueName : String!
	var userType : Int!
	var version : Int!
	var watchword : String!


	/**
	 * Instantiate the instance using the passed dictionary values to set the properties values
	 */
	init(fromDictionary dictionary: NSDictionary){
		addrBookSize = dictionary["addrBookSize"] as? Int
		allowPush = dictionary["allowPush"] as? Int
		appState = dictionary["appState"] as? Int
		branch = dictionary["branch"] as? String
		branchID = dictionary["branchID"] as? Int
		cid = dictionary["cid"] as? String
		company = dictionary["company"] as? String
		if let deviceData = dictionary["device"] as? NSDictionary{
				device = LoginRetDevice(fromDictionary: deviceData)
			}
		devices = [LoginRetDevice]()
		if let devicesArray = dictionary["devices"] as? [NSDictionary]{
			for dic in devicesArray{
				let value = LoginRetDevice(fromDictionary: dic)
				devices.append(value)
			}
		}
		displayName = dictionary["displayName"] as? String
		duty = dictionary["duty"] as? String
		email = dictionary["email"] as? String
		enableAccont = dictionary["enableAccont"] as? Bool
		enableMultiSendSms = dictionary["enableMultiSendSms"] as? Bool
		enableSendSms = dictionary["enableSendSms"] as? Bool
		headImageUrl = dictionary["headImageUrl"] as? String
		id = dictionary["id"] as? Int
		isFirst = dictionary["isFirst"] as? Bool
		isLocked = dictionary["isLocked"] as? Bool
		loginName = dictionary["loginName"] as? String
		loginState = dictionary["loginState"] as? Int
		mainRole = dictionary["mainRole"] as? Int
		mobile = dictionary["mobile"] as? String
		needSMS = dictionary["needSMS"] as? Bool
		password = dictionary["password"] as? String
		position = dictionary["position"] as? Int
		roles = dictionary["roles"] as? String
		secret = dictionary["secret"] as? Int
		serverID = dictionary["serverID"] as? String
		sex = dictionary["sex"] as? Int
		shortMobile = dictionary["shortMobile"] as? String
		tel = dictionary["tel"] as? String
		timestamp = dictionary["timestamp"] as? Int
		trueName = dictionary["trueName"] as? String
		userType = dictionary["userType"] as? Int
		version = dictionary["version"] as? Int
		watchword = dictionary["watchword"] as? String
	}

	/**
	 * Returns all the available property values in the form of NSDictionary object where the key is the approperiate json key and the value is the value of the corresponding property
	 */
	func toDictionary() -> NSDictionary
	{
		var dictionary = NSMutableDictionary()
		if addrBookSize != nil{
			dictionary["addrBookSize"] = addrBookSize
		}
		if allowPush != nil{
			dictionary["allowPush"] = allowPush
		}
		if appState != nil{
			dictionary["appState"] = appState
		}
		if branch != nil{
			dictionary["branch"] = branch
		}
		if branchID != nil{
			dictionary["branchID"] = branchID
		}
		if cid != nil{
			dictionary["cid"] = cid
		}
		if company != nil{
			dictionary["company"] = company
		}
		if device != nil{
			dictionary["device"] = device.toDictionary()
		}
		if devices != nil{
			var dictionaryElements = [NSDictionary]()
			for devicesElement in devices {
				dictionaryElements.append(devicesElement.toDictionary())
			}
			dictionary["devices"] = dictionaryElements
		}
		if displayName != nil{
			dictionary["displayName"] = displayName
		}
		if duty != nil{
			dictionary["duty"] = duty
		}
		if email != nil{
			dictionary["email"] = email
		}
		if enableAccont != nil{
			dictionary["enableAccont"] = enableAccont
		}
		if enableMultiSendSms != nil{
			dictionary["enableMultiSendSms"] = enableMultiSendSms
		}
		if enableSendSms != nil{
			dictionary["enableSendSms"] = enableSendSms
		}
		if headImageUrl != nil{
			dictionary["headImageUrl"] = headImageUrl
		}
		if id != nil{
			dictionary["id"] = id
		}
		if isFirst != nil{
			dictionary["isFirst"] = isFirst
		}
		if isLocked != nil{
			dictionary["isLocked"] = isLocked
		}
		if loginName != nil{
			dictionary["loginName"] = loginName
		}
		if loginState != nil{
			dictionary["loginState"] = loginState
		}
		if mainRole != nil{
			dictionary["mainRole"] = mainRole
		}
		if mobile != nil{
			dictionary["mobile"] = mobile
		}
		if needSMS != nil{
			dictionary["needSMS"] = needSMS
		}
		if password != nil{
			dictionary["password"] = password
		}
		if position != nil{
			dictionary["position"] = position
		}
		if roles != nil{
			dictionary["roles"] = roles
		}
		if secret != nil{
			dictionary["secret"] = secret
		}
		if serverID != nil{
			dictionary["serverID"] = serverID
		}
		if sex != nil{
			dictionary["sex"] = sex
		}
		if shortMobile != nil{
			dictionary["shortMobile"] = shortMobile
		}
		if tel != nil{
			dictionary["tel"] = tel
		}
		if timestamp != nil{
			dictionary["timestamp"] = timestamp
		}
		if trueName != nil{
			dictionary["trueName"] = trueName
		}
		if userType != nil{
			dictionary["userType"] = userType
		}
		if version != nil{
			dictionary["version"] = version
		}
		if watchword != nil{
			dictionary["watchword"] = watchword
		}
		return dictionary
	}

}