//
//  Document.swift
//  iPOS
//
//  Created by Apple iMac on 12/07/2017.
//  Copyright © 2017 BBC. All rights reserved.
//

import Foundation
import ObjectMapper

class Document: Mappable{
    var documentId: String?
    var name: String?
    var createTime: Date?
    var contactId: String?
    var documentType: Int?
    var layoutId: Int?
    var layoutType: String?
    var binaryData: String?
    var invoiceNumber: String = ""
    var documentTypeName: String = ""
    
    init(){
        
    }
    
    required init?(map: Map){
        
    }
    
    func mapping(map: Map) {
        documentId <- map["DocumentId"]
        name <- map["Name"]
        createTime <- (map["CreateTime"], Util.CustomDateTransform())
        contactId <- map["ContactId"]
        documentType <- map["DocumentType"]
        binaryData <- map["BinaryData"]
        invoiceNumber <- map["InvoiceNumber"]
        documentTypeName <- map["DocumentTypeName"]
        layoutId <- map["LayoutId"]
        layoutType <- map["LayoutType"]
    }
}

class DocumentType: Mappable, INameable{
    var attachmentTypeId: Int?
    var description: String?
    var customName: String { return self.description! }
    var customSubtitle: String? { return nil }
    
    init(){
        
    }
    
    required init?(map: Map){
        
    }
    
    func mapping(map: Map) {
        attachmentTypeId <- map["AttachmentTypeId"]
        description <- map["Description"]
    }

}
