//
//  EffectVoucher.swift
//  iPOS
//
//  Created by Daniel Ciuciu on 23/10/24.
//  Copyright © 2024 BBC. All rights reserved.
//

import Foundation
import ObjectMapper

class EffectVoucher: Mappable {
    var code: String = ""
    var voucherGeneratorId: Int = 0
    var value: Float = 0
    var effectVoucherGeneratorCode: String = ""
    var isRowDiscountEffect: Bool = false
    var printableTicketLines: [String] = []
    var contactId: UUID?
    var promotionId: Int?
    
    
    required init?(map: Map) {
    }
    
    init(code: String, voucherGeneratorId: Int, value: Float, printableTicketLines: [String], contactId: UUID? = nil, promotionId: Int? = nil) {
        self.code = code
        self.voucherGeneratorId = voucherGeneratorId
        self.value = value
        //self.voucherGeneratorId = voucherGeneratorId
        self.printableTicketLines = printableTicketLines
        self.contactId = contactId
        self.promotionId = promotionId
    }
    
    func mapping(map: Map) {
        code <- map["Code"]
        voucherGeneratorId <- map["VoucherGeneratorId"]
        value <- map["Value"]
        effectVoucherGeneratorCode <- map["EffectVoucherGeneratorCode"]
        isRowDiscountEffect <- map["IsRowDiscountEffect"]
        printableTicketLines <- map["PrintableTicketLines"]
        contactId <- (map["ContactId"], Util.CustomUuidTransform())
        promotionId <- map["PromotionId"]
    }
}
