//
//  Appointment.swift
//  iPOS
//
//  Created by bbc on 20/01/17.
//  Copyright © 2017 BBC. All rights reserved.
//

import Foundation
import ObjectMapper

class Appointment: Mappable {
    var UniqueId: Int!
    var StartDate: Date?
    var EndDate: Date?
    var IsAllDay: Bool?
    var Subject: String?
    var Location: String?
    var Description: String?
    var Status: Int?
    var Label: Int?
    var StoreId: Int?
    var ContactId: String?
    var EventID: String?
    
    var contact: Contact? = Contact()
    
    func mapping(map: Map) {
        UniqueId <- map["UniqueID"]
        StartDate <- (map["StartDate"], Util.CustomDateTransform())
        EndDate <- (map["EndDate"], Util.CustomDateTransform())
        IsAllDay <- map["AllDay"]
        Subject <- map["Subject"]
        Location <- map["Location"]
        Description <- map["Description"]
        Status <- map["Status"]
        Label <- map["Label"]
        StoreId <- map["StoreId"]
        ContactId <- map["ContactId"]
        contact <- map["Contacts"]
    }
    
    required init?(map: Map) {
        
    }
    
    init() {
        
    }
    
    func clone() -> Appointment{
        let clone = Appointment()
        
        clone.UniqueId = self.UniqueId
        clone.StartDate = self.StartDate
        clone.EndDate = self.EndDate
        clone.IsAllDay = self.IsAllDay
        clone.Subject = self.Subject
        clone.Location = self.Location
        clone.Description = self.Description
        clone.Status = self.Status
        clone.Label = self.Label
        clone.StoreId = self.StoreId
        clone.ContactId = self.ContactId
        clone.EventID = self.EventID
        
        clone.contact = self.contact
        
        return clone
    }
}
