import sys
from datetime import datetime
from PyQt5.QtWidgets import QApplication

from src.components import Os_Label_Printer
from src.lib.helpers import ConfigReader

config = ConfigReader(system_id="st-ten-15")
time =datetime.now()
context = {
    # RECIPE DATA
    "RECIPE": "000992752",
    "PART": "000992752",
    "TFILL": "5",
    "TSET": "10",
    "TTEST": "10",
    "PSETMINP_A": "4750",
    "PSETMAXP_A": "5250",
    "PTEST": "5000",
    "PMIN": "30",
    "RESPSET": "5123",
    "RESLEAK": "12.34",
    "SN4": "1234",
    # TIME DEFINITION
    "DATETIME": time.strftime("%d/%m/%Y %H:%M:%S"),
    "DATE": time.strftime("%d/%m/%Y"),
    "TIME": time.strftime("%H:%M:%S"),
    "YYYY": time.strftime("%Y"),
    "YY": time.strftime("%y"),
    "MO": time.strftime("%m"),
    "DD": time.strftime("%d"),
    "HH": time.strftime("%H"),
    "MI": time.strftime("%M"),
    "SS": time.strftime("%S"),
    "JJJ": time.strftime("%j"),
    # EXTRA DATA
    "SHIFT": "1",
    "STATION": "ST-TEN-1",
    "OPERATOR": "MARIO",
    "BADGE_NUM": "999",

}

app = QApplication(sys.argv)

if "--extra" in sys.argv:
    # TEST EXTRA PRINTER
    printer = Os_Label_Printer(config=config, name="extra_label_printer")
    printer.config_changed()
    printer.print_label("MI1.prn")
else:
    # TEST STANDARD PRINTER
    printer = Os_Label_Printer(config=config, name="label_printer")
    printer.config_changed()
    printer.print_label("F164F169.prn", context=context)
