<?php

namespace App\Database\Seeds;

use App\Models\Configuracion\ImpresoraEtiquetaModel;
use CodeIgniter\Database\Seeder;


class EtiquetaImpresoraSeeder extends Seeder
{
    public function run()
    {
        $data = [
            [
                "name" => "GC420d",
                "tipo" => 0,
                "ip" => "83.61.19.226",
                "port" => 9101,
                "description" => "cat rutadocumento | netcat -w 1 83.61.19.226 9101"
            ],
            [
                "name" => "LABPRINT-1",
                "tipo" => 1,
                "ip" => "83.61.19.226",
                "port" => 9102,
                "user" => "52J153500357"
            ],
            [
                "name" => "LABPRINT-2",
                "tipo" => 1,
                "ip" => "83.61.19.226",
                "port" => 9103,
                "user" => "52J153500357"

            ]
        ];
        $etiquetaImpresoraModel = model(ImpresoraEtiquetaModel::class);
        foreach ($data as $key => $impresoraData) {
            $impresoraCount = $etiquetaImpresoraModel->where('name',$impresoraData["name"])->countAllResults();
            if($impresoraCount == 0){
                $etiquetaImpresoraModel->insert($impresoraData);
            }
        }
    }
}
