<?php

namespace Config;

use CodeIgniter\Config\BaseConfig;

class Printers extends BaseConfig
{
    public array $printers = [
        "zebracs1" => [
            "name" => "CS 2 Printer",
            "command" => "copy /B file.txt \\\\glenlis\\zebracs1",
        ],
        "zebracs2" => [
            "name" => "CS 4 Printer",
            "command" => "copy /B file.txt \\\\glenlis\\zebracs2",
        ],
        "zebracs3" => [
            "name" => "CS Lab Printer",
            "command" => "copy /B file.txt \\\\glenlis\\zebracs3",
        ],
        "zebralab" => [
            "name" => "Lab Printer",
            "command" => "copy /B file.txt \\\\glenlis\\zebralab",
        ],
    ];

    public array $roleDefaults = [
        0 => "zebracs2",
        1 => "zebralab",
        2 => "zebralab",
        3 => "zebracs2",
        4 => "zebracs2",
    ];

    public string $defaultPrinter = "zebracs2";

    public function getPrinter(string $printerKey): ?array
    {
        return $this->printers[$printerKey] ?? null;
    }

    public function getCommand(string $printerKey): ?string
    {
        return $this->printers[$printerKey]["command"] ?? null;
    }

    public function getDefaultForRole(int $roleId): string
    {
        return $this->roleDefaults[$roleId] ?? $this->defaultPrinter;
    }
}
