<?php
/**
 *
 * @version     1.0.$Revision:$
 * @version     SVN: $Id:$
 * @package     bplan-base/globals
 * @subpackage  Seeders
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 * @copyright   Copyright (C) 2025 bplan-solutions GmbH & Co. KG <https://www.bplan-solutions.de/>
 * /Δ\
 */

namespace BplanBase\Globals\Database\Seeders;

use BplanBase\Globals\Models\PrinterType;
use Illuminate\Database\Seeder;
use Illuminate\Support\Str;


/**
 *
 * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
 */
class PrinterTypeSeeder extends Seeder
{

    /**
     * Run the database seeds.
     *
     * @return void
     *
     * @author      Wassilios Meletiadis <wassilios.meletiadis@bplan-solutions.de>
     */
    public function run()
    {
        $date = date('Y-m-d H:i:s');

        PrinterType::insert([
            [
                'uuid'             => Str::uuid(),
                'active'           => 1,
                'created_at'       => $date,
                'updated_at'       => $date,
                'brand'            => 'Mock',
                'config_template'  => '{}',
                'description'      => 'Simulierter Drucker für Entwicklung und Integrationstests ohne Hardware.',
                'endpoint_prefix'  => null,
                'identifier'       => 'Mock',
                'label'            => 'Mock (Dev)',
                'model'            => 'Mock',
                'payload_template' => '{}',
            ],
            [
                'uuid'             => Str::uuid(),
                'active'           => 1,
                'created_at'       => $date,
                'updated_at'       => $date,
                'brand'            => 'Custom',
                'config_template'  => json_encode([
                    '.meta' => [
                        'labels' => [
                            'de' => [
                                'cut'              => 'Schneidemodus',
                                'scaleMode'        => 'Skalierungsmodus',
                                'copies'           => 'Kopien',
                                'section.default'  => 'Druckeinstellungen',
                            ],
                            'en' => [
                                'cut'              => 'Cut Mode',
                                'scaleMode'        => 'Scale Mode',
                                'copies'           => 'Copies',
                                'section.default'  => 'Print Settings',
                            ],
                        ],
                        'order' => ['cut', 'scaleMode', 'copies'],
                    ],
                    'copies'    => ['type' => 'number', 'default' => 1],
                    'cut'       => ['type' => 'select', 'options' => ['total', 'partial', 'none'], 'default' => 'total'],
                    'scaleMode' => ['type' => 'select', 'options' => ['fit', 'width', 'none'], 'default' => 'fit'],
                ]),
                'description'      => 'Thermo-Drucker für Belege und Etiketten.',
                'endpoint_prefix'  => 'custom-printer',
                'identifier'       => 'CustomKPM180H',
                'label'            => 'Custom KPM180H',
                'model'            => 'KPM180H',
                'payload_template' => json_encode(['cut' => 'total', 'scaleMode' => 'fit', 'copies' => 1]),
            ],
            [
                'uuid'             => Str::uuid(),
                'active'           => 1,
                'created_at'       => $date,
                'updated_at'       => $date,
                'brand'            => 'Custom',
                'config_template'  => json_encode([
                    '.meta' => [
                        'labels' => [
                            'de' => [
                                'cut'              => 'Schneidemodus',
                                'scaleMode'        => 'Skalierungsmodus',
                                'copies'           => 'Kopien',
                                'section.default'  => 'Druckeinstellungen',
                            ],
                            'en' => [
                                'cut'              => 'Cut Mode',
                                'scaleMode'        => 'Scale Mode',
                                'copies'           => 'Copies',
                                'section.default'  => 'Print Settings',
                            ],
                        ],
                        'order' => ['cut', 'scaleMode', 'copies'],
                    ],
                    'copies'    => ['type' => 'number', 'default' => 1],
                    'cut'       => ['type' => 'select', 'options' => ['total', 'partial', 'none'], 'default' => 'total'],
                    'scaleMode' => ['type' => 'select', 'options' => ['fit', 'width', 'none'], 'default' => 'fit'],
                ]),
                'description'      => 'Thermo-Drucker für Belege und Etiketten.',
                'endpoint_prefix'  => 'custom-printer',
                'identifier'       => 'CustomVKP80III',
                'label'            => 'Custom VKP80III',
                'model'            => 'VKP80III',
                'payload_template' => json_encode(['cut' => 'total', 'scaleMode' => 'fit', 'copies' => 1]),
            ],
            [
                'uuid'             => Str::uuid(),
                'active'           => 1,
                'created_at'       => $date,
                'updated_at'       => $date,
                'brand'            => 'Evolis',
                'config_template'  => json_encode([
                    '.meta' => [
                        'labels' => [
                            'de' => [
                                'cut'              => 'Schneidemodus',
                                'scaleMode'        => 'Skalierungsmodus',
                                'copies'           => 'Kopien',
                                'section.default'  => 'Druckeinstellungen',
                            ],
                            'en' => [
                                'cut'              => 'Cut Mode',
                                'scaleMode'        => 'Scale Mode',
                                'copies'           => 'Copies',
                                'section.default'  => 'Print Settings',
                            ],
                        ],
                        'order' => ['cut', 'scaleMode', 'copies'],
                    ],
                    'copies'    => ['type' => 'number', 'default' => 1],
                    'cut'       => ['type' => 'select', 'options' => ['total', 'partial', 'none'], 'default' => 'total'],
                    'scaleMode' => ['type' => 'select', 'options' => ['fit', 'width', 'none'], 'default' => 'fit'],
                ]),
                'description'      => 'Kartendrucker für ID- und Zugangskarten.',
                'endpoint_prefix'  => 'evolis-printer',
                'identifier'       => 'EvolisKCPrime',
                'label'            => 'Evolis KC Prime',
                'model'            => 'KC Prime',
                'payload_template' => json_encode(['outputTray' => 'STANDARD']),
            ],
            [
                'uuid'             => Str::uuid(),
                'active'           => 1,
                'created_at'       => $date,
                'updated_at'       => $date,
                'brand'            => 'SwiftPro',
                'config_template'  => json_encode([
                    '.meta' => [
                        'labels' => [
                            'de' => [
                                'useKPanel'        => 'K-Panel verwenden',
                                'filmInit'         => 'Film-Init',
                                'section.default'  => 'Druckeinstellungen',
                            ],
                            'en' => [
                                'useKPanel'        => 'Use K-Panel',
                                'filmInit'         => 'Film Init',
                                'section.default'  => 'Print Settings',
                            ],
                        ],
                        'order' => ['useKPanel', 'filmInit'],
                    ],
                    'filmInit'   => ['type' => 'number', 'default' => 0],
                    'useKPanel'  => ['type' => 'toggle', 'default' => false],
                ]),
                'description'      => 'Kartendrucker mit Retransfer-Technologie.',
                'endpoint_prefix'  => 'swiftpro-printer',
                'identifier'       => 'SwiftProK30',
                'label'            => 'SwiftPro K30',
                'model'            => 'K 30',
                'payload_template' => json_encode(['useKPanel' => false, 'filmInit' => 0]),
            ],

        ]);

    } // run()

} // class PrinterTypeSeeder extends Seeder {}
