//
//  FrameProductViewController.swift
//  iPOS
//
//  Created by Zoran Albu on 12/14/17.
//  Copyright © 2017 BBC. All rights reserved.
//

import Foundation
import UIKit
import ObjectMapper

class CustomProductResponse: Mappable {
    var odataMetadata: String?
    var value: [CustomProduct]?
    
    required init?(map: Map){
        
    }
    
    func mapping(map: Map) {
        odataMetadata <- map["odata.metadata"]
        value <- map["value"]
    }
}


class CustomProduct: Mappable{
    var storeId:Int!
    
    var productId:String?
    var styleId:Int?
    
    var code:String!
    var name:String?
    var barcode:String?
    
    var producerId:Int?
    var producerCode: String?
    var producerName:String?
    
    var producerLineId:Int?
    var producerLineName:String?
    
    var supplierId:Int?
    var supplierName:String?
    
    var seasonId:Int?
    var seasonName:String?
    
    var materialId:Int?
    var materialName:String?
    
    var colorGroupId:Int?
    var colorGroupName:String?
    var colorId:Int?
    var colorName:String?
    
    var productSubfamilyId:Int?
    var productSubfamilyName:String?
    var productFamilyName:String?
    var productFamilyId:Int?
    
    var sizeClassId:Int?
    var sizeClassName:String?
    var sizeId:Int?
    var sizeCode:String?
    
    var seasonalityName: String?
    var productTypeName: String?
    var productGroupName: String?
    var compositionName: String?
    var themeName: String?
    var eventName: String?
    var linkageName: String?
    var unitOfMeasureName: String?
    var originCountryName: String?
    var vatCode: String?
    var vatName: String?
    var customCode: String?
    var description: String?
    
    var isPriceChangeRequired: Bool? = false
    var isManualVoucher: Bool? = false
    var hasSerialNumber: Bool? = false
    var medicalDevice: Bool? = false
    var isSensitive: Bool? = false
    var isReplenishable: Bool? = true
    var isReorderable: Bool? = true
    var isNickelFree: Bool? = false
    var isPosSaleEnabled: Bool? = true
    var isWorkOrderSaleEnabled: Bool? = true
    var isOutOfStockEnabled: Bool? = true
    var isDiscountEnabled: Bool? = true
    var isSyncEnabled: Bool? = true
    
    var volumeInCm3: Int?
    var weightInGrams: Int?
    var minReorderQty: Int?
    
    var salePrice:Double?
    var acqPrice:Double?
    var stockQty:Int? = 0
    
    var attribute0Id:Int?
    var attribute0Name:String?
    var attribute0Code:String?
    var attribute1Id:Int?
    var attribute1Name:String?
    var attribute1Code:String?
    var attribute2Id:Int?
    var attribute2Name:String?
    var attribute2Code:String?
    var attribute3Id:Int?
    var attribute3Name:String?
    var attribute3Code:String?
    var attribute4Id:Int?
    var attribute4Name:String?
    var attribute4Code:String?
    var attribute5Id:Int?
    var attribute5Name:String?
    var attribute5Code:String?
    var attribute6Id:Int?
    var attribute6Name:String?
    var attribute6Code:String?
    var attribute7Id:Int?
    var attribute7Name:String?
    var attribute7Code:String?
    var attribute8Id:Int?
    var attribute8Name:String?
    var attribute8Code:String?
    var attribute9Id:Int?
    var attribute9Name:String?
    var attribute9Code:String?
    
    var productImages: [ProductImages] = [ProductImages]()
    
    var featuresForProduct: [FeaturesForProduct] = [FeaturesForProduct]()
    
    init() {
        self.storeId = Int(settings.StoreId)
    }
    
    required init?(map: Map) {
        
    }
    
    func mapping(map: Map) {
        storeId <- map["StoreId"]
        
        productId <- map["ProductId"]
        styleId <- map["StyleId"]
        
        code <- map["ProductCode"]
        name <- map["ProductName"]
        barcode <- map["Barcode"]
        
        materialId <- map["MaterialId"]
        materialName <- map["MaterialName"]
        
        producerId <- map["ProducerId"]
        producerCode <- map["ProducerCode"]
        producerName <- map["ProducerName"]
        
        producerLineId <- map["ProducerLineId"]
        producerLineName <- map["ProducerLineName"]
        
        supplierId <- map["SupplierId"]
        supplierName <- map["SupplierName"]
        
        seasonId <- map["SeasonId"]
        seasonName <- map["SeasonName"]
        
        colorGroupName <- map["ColorGroupName"]
        colorGroupId <- map["ColorGroupId"]
        colorId <- map["ColorId"]
        colorName <- map["ColorName"]
        
        productFamilyName <- map["ProductFamilyName"]
        productFamilyId <- map["ProductFamilyId"]
        productSubfamilyId <- map["ProductSubfamilyId"]
        productSubfamilyName <- map["ProductSubfamilyName"]
        
        sizeClassName <- map["SizeClassName"]
        sizeClassId <- map["SizeClassId"]
        sizeCode <- map["SizeCode"]
        sizeId <- map["SizeId"]
        
        seasonalityName <- map["SeasonalityName"]
        productTypeName <- map["ProductTypeName"]
        productGroupName <- map["ProductGroupName"]
        compositionName <- map["CompositionName"]
        themeName <- map["ThemeName"]
        eventName <- map["EventName"]
        unitOfMeasureName <- map["UnitOfMeasureName"]
        linkageName <- map["LinkageName"]
        originCountryName <- map["OriginCountryName"]
        vatCode <- map["VatCode"]
        vatName <- map["VatName"]
        customCode <- map["CustomCode"]
        description <- map["Description"]
        
        isPriceChangeRequired <- map["IsPriceChangeRequired"]
        isManualVoucher <- map["IsManualVoucher"]
        hasSerialNumber <- map["HasSerialNumber"]
        medicalDevice <- map["MedicalDevice"]
        isSensitive <- map["IsSensitive"]
        isReplenishable <- map["IsReplenishable"]
        isReorderable <- map["IsReorderable"]
        isNickelFree <- map["IsNickelFree"]
        isPosSaleEnabled <- map["IsPosSaleEnabled"]
        isWorkOrderSaleEnabled <- map["IsWorkOrderSaleEnabled"]
        isOutOfStockEnabled <- map["IsOutOfStockEnabled"]
        isDiscountEnabled <- map["IsDiscountEnabled"]
        isSyncEnabled <- map["IsSyncEnabled"]
        
        volumeInCm3 <- map["VolumeInCm3"]
        weightInGrams <- map["WeightInGrams"]
        minReorderQty <- map["MinReorderQty"]
        
        salePrice <- (map["SalePrice"], Util.CustomDoubleTransform())
        acqPrice <- (map["AcquisitionPrice"], Util.CustomDoubleTransform())
        stockQty <- map["AvailableStockQuantity"]
        
        attribute0Id <- map["Attribute0Id"]
        attribute0Name <- map["Attribute0Name"]
        attribute0Code <- map["Attribute0Code"]
        attribute1Id <- map["Attribute1Id"]
        attribute1Name <- map["Attribute1Name"]
        attribute1Code <- map["Attribute1Code"]
        attribute2Id <- map["Attribute2Id"]
        attribute2Name <- map["Attribute2Name"]
        attribute2Code <- map["Attribute2Code"]
        attribute3Id <- map["Attribute3Id"]
        attribute3Name <- map["Attribute3Name"]
        attribute3Code <- map["Attribute3Code"]
        attribute4Id <- map["Attribute4Id"]
        attribute4Name <- map["Attribute4Name"]
        attribute4Code <- map["Attribute4Code"]
        attribute5Id <- map["Aattribute5Id"]
        attribute5Name <- map["Attribute5Name"]
        attribute5Code <- map["Attribute5Code"]
        attribute6Id <- map["Attribute6Id"]
        attribute6Name <- map["Attribute6Name"]
        attribute6Code <- map["Attribute6Code"]
        attribute7Id <- map["Attribute7Id"]
        attribute7Name <- map["Attribute7Name"]
        attribute7Code <- map["Attribute7Code"]
        attribute8Id <- map["Attribute8Id"]
        attribute8Name <- map["Attribute8Name"]
        attribute8Code <- map["Attribute8Code"]
        attribute9Id <- map["Attribute9Id"]
        attribute9Name <- map["Attribute9Name"]
        attribute9Code <- map["Attribute9Code"]
        
        productImages <- map["ProductImages"]
        
        featuresForProduct <- map["FeaturesForProduct"]
    }
}
