//
//  PrintersData.swift
//  iPOS
//
//  Created by BBC on 19/06/17.
//  Copyright © 2017 BBC. All rights reserved.
//

import Foundation

enum PrinterType: Int{
    case fiscalPrinter = 0
    case nonFiscalPrinter = 1
}

enum PrinterManufacturer: String{
    case epson = "EPSON INTELLIGENT (NON FISCAL)"
    case epsonInteligent = "EPSON INTELLIGENT"
    case ditron = "DITRON"
}

class PrinterData{
    static let insufficientPaperWidthPrinters: [Int] = [2]
    
    static let FiscalManufacturers: [String] = [PrinterManufacturer.epsonInteligent.rawValue, PrinterManufacturer.ditron.rawValue]
    static let NonFiscalManufacturers: [String] = [PrinterManufacturer.epson.rawValue]
    
    static let epsonFiscalModels: [String] = []
    static let epsonNonFiscalModels: [String] = ["TM-M10","TM-M30","TM-P20","TM-P60","TM-P60II","TM-P80","TM-T20","TM-T60","TM-T70","TM-T81","TM-T82","TM-T83","TM-T88","TM-T90","TM-T90KP","TM-U220","TM-U330","TM-L90","TM-H6000"]
    
    static let ditronFiscalModels: [String] = []
    static let ditronNonFiscalModels: [String] = []
    
    static let epsonFiscalColumns:[[Int]] = [[]]
    static let epsonNonFiscalColumns:[[Int]] = [[35,42,46],[48,57,64],[32,42,42,38,48],[35,42,52],[36,43,54],[36,43,54],[48,64],[52,42,35],[56,42],[42,56],[48,64],[48,64],[42,56],[56,42],[56,42],[40,42,33,35],[40,42],[48,64],[42,56]]
    
    static let ditronFiscalColumns:[[Int]] = [[]]
    static let ditronNonFiscalColumns:[[Int]] = [[]]
    
    static func getPrinterManufacturers(type: Int) -> [String]{
        if type == PrinterType.fiscalPrinter.rawValue{
            return FiscalManufacturers
        }
        else if type == PrinterType.nonFiscalPrinter.rawValue{
            return NonFiscalManufacturers
        }
        return []
    }
    
    static func getPrinterSeries(manufacturer: String, type: Int) -> [String]{
        if type == PrinterType.fiscalPrinter.rawValue{
            if manufacturer == PrinterManufacturer.epsonInteligent.rawValue{
                return []
            }
            else if manufacturer == PrinterManufacturer.ditron.rawValue{
                return []
            }
        }
        else if type == PrinterType.nonFiscalPrinter.rawValue{
            if manufacturer == PrinterManufacturer.epson.rawValue{
                return epsonNonFiscalModels
            }
            else if manufacturer == PrinterManufacturer.ditron.rawValue{
                return []
            }
        }
        return []
    }
    
    static func getPrinterColumns(manufacturer: String, type: Int) -> [[Int]]{
        if type == PrinterType.fiscalPrinter.rawValue{
            if manufacturer == PrinterManufacturer.epsonInteligent.rawValue{
                return [[]]
            }
            else if manufacturer == PrinterManufacturer.ditron.rawValue{
                return [[]]
            }
        }
        else if type == PrinterType.nonFiscalPrinter.rawValue{
            if manufacturer == PrinterManufacturer.epson.rawValue{
                return epsonNonFiscalColumns
            }
            else if manufacturer == PrinterManufacturer.ditron.rawValue{
                return [[]]
            }
        }
        return [[]]
    }
}
