//
//  EmailRequest.swift
//  iPOS
//
//  Created by Apple iMac on 28/06/2018.
//  Copyright © 2018 BBC. All rights reserved.
//

import Foundation
import ObjectMapper

class EmailRequest: Mappable{
    var storeId: Int = Int(settings.StoreId)!
    var cashRegister: Int = Int(settings.CashRegister)!
    var email: String = ""
    var subject: String?
    var body: String?
    var reportType: String?
    var attachments: [EmailAttachment] = [EmailAttachment]()
    
    func mapping(map: Map) {
        storeId <- map["StoreId"]
        cashRegister <- map["CashRegister"]
        email <- map["Email"]
        subject <- map["Subject"]
        body <- map["Body"]
        reportType <- map["ReportType"]
        attachments <- map["Attachments"]
    }
    
    required init?(map: Map) {
    }
    
    init(email: String, subject: String, body: String, attachments: [EmailAttachment]?) {
        self.email = email
        self.subject = subject
        self.body = body
        if attachments != nil{
            self.attachments = attachments!
        }
    }
    
    init(email: String, reportType: String, attachments: [EmailAttachment]?) {
        self.email = email
        self.reportType = reportType
        if attachments != nil{
            self.attachments = attachments!
        }
    }
}
