//
//  Attachment.swift
//  iPOS
//
//  Created by BBC on 10/04/17.
//  Copyright © 2017 BBC. All rights reserved.
//

import Foundation
import ObjectMapper

class Attachment: Mappable {
    var Name: String?
    var TableName: String?
    var TableKey: String?
    var AttachmentTypeId: Int?
    var BinaryData: String?
    var StoreId: Int?
    var UserId: UUID?

    required init?(map: Map){
        self.StoreId = Int(settings.StoreId)!
        self.UserId = UUID.init(uuidString: settings.LoggedInUserId!)
    }
    
    init(){
        self.StoreId = Int(settings.StoreId)!
        self.UserId = UUID.init(uuidString: settings.LoggedInUserId!)
    }
    
    func mapping(map: Map) {
        Name <- map["Name"]
        TableName <- map["TableName"]
        TableKey <- map["TableKey"]
        AttachmentTypeId <- map["AttachmentTypeId"]
        BinaryData <- map["BinaryData"]
        StoreId <- map["StoreId"]
        UserId <- (map["UserId"], Util.CustomUuidTransform())
    }
}
