<?php

namespace Database\Seeders;

use App\Enums\DbStatusFieldEnum;
use App\Models\Supplier;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use JeroenZwart\CsvSeeder\CsvSeeder;

// class SupplierSeeder extends Seeder
class SupplierSeeder extends CsvSeeder
{
    public function __construct()
    {
        $this->tablename = 'suppliers';
        $this->delimiter = ';';
        $this->file = base_path().'/database/csv/suppliers2.csv';
        $this->truncate = false;
    }

    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        DB::table($this->tablename)->delete();
        parent::run();

        return true;
        $suppliers = [
            [
                'name' => 'Ázsia Gastro Élelmiszer Kft.',
                'hooreycaId' => 'S402',
                'nameId' => 'ÁZSIA',
                'OrderEmail' => 'azsiagastro@t-online.hu',
                'Address' => 'ÁZSIA',
                'supplierPhone' => '+3619506161',
            ],
            [
                'name' => 'Egertej Tejipari Kft.',
                'hooreycaId' => 'S308',
                'nameId' => 'EGERTEJ',
                'OrderEmail' => 'rendeles@egertej.hu',
                'Address' => 'EGERTEJ'.' utca',
                'supplierPhone' => '',
            ],
            [
                'hooreycaId' => 'S1747',
                'nameId' => 'PÉKPONT',
                'name' => 'Első MagyarPékpont-rendsz.Kft.',
                'OrderEmail' => '',
                'Address' => ''.' utca',
                'supplierPhone' => '',
            ],
            [
                'hooreycaId' => 'S4555',
                'nameId' => 'FUNKCIÓ',
                'name' => 'Funkció Kft.',
                'OrderEmail' => '',
                'Address' => ''.' utca',
                'supplierPhone' => '',

            ],
            [
                'hooreycaId' => 'S381',
                'nameId' => 'HÚSHÁZ',
                'name' => 'Húsház Hungary Kft.',
                'OrderEmail' => '',
                'Address' => ''.' utca',
                'supplierPhone' => '',
            ],
            [
                'hooreycaId' => 'S354',
                'nameId' => 'ILLKER',
                'name' => 'Illker-Food Kft.',
                'OrderEmail' => '',
                'Address' => ''.' utca',
                'supplierPhone' => '',
            ],
            [
                'hooreycaId' => 'S740',
                'nameId' => 'JÁNER',
                'name' => 'Jáner Hús Zrt.',
                'OrderEmail' => '',
                'Address' => ''.' utca',
                'supplierPhone' => '',
            ],
            [
                'hooreycaId' => 'S5911',
                'nameId' => 'MAUS',
                'name' => 'Maus Kft.',
                'OrderEmail' => '',
                'Address' => ''.' utca',
                'supplierPhone' => '',
            ],
            [
                'hooreycaId' => 'S509',
                'nameId' => 'P&P',
                'name' => 'P&P Pékáru Kft.',
                'OrderEmail' => '',
                'Address' => ''.' utca',
                'supplierPhone' => '',
            ],
            [
                'hooreycaId' => 'S202',
                'nameId' => 'PR1MER',
                'name' => 'Pr1mer Kft.',
                'OrderEmail' => '',
                'Address' => ''.' utca',
                'supplierPhone' => '',
            ],
            [
                'hooreycaId' => 'S482',
                'nameId' => 'PRIBO',
                'name' => 'Pribofood Kft',
                'OrderEmail' => '',
                'Address' => ''.' utca',
                'supplierPhone' => '',
            ],
            [
                'hooreycaId' => 'S286',
                'nameId' => 'RAUCH',
                'name' => 'Rauch Hungária Kft.',
                'OrderEmail' => '',
                'Address' => ''.' utca',
                'supplierPhone' => '',
            ],
            [
                'hooreycaId' => 'S1084',
                'nameId' => 'ROZMÁR',
                'name' => 'Voyagex Morini Kft.',
                'OrderEmail' => '',
                'Address' => ''.' utca',
                'supplierPhone' => '',
            ],
            [
                'hooreycaId' => 'S6776',
                'nameId' => 'ZALACO',
                'name' => 'Zalaco',
            ],
        ];

        foreach ($suppliers as $itemData) {
            $itemData['status'] = DbStatusFieldEnum::active;
            $supplier = new Supplier($itemData);
            $supplier->save();
        }
    }
}
