<?php

use App\Models\Booking;
use App\Models\Company;
use App\Models\Transaction;
use App\Classes\ValueObjects\Constants\TransactionType;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class UpdateSuppliersReferenceSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        DB::beginTransaction();

        $suppliers = Company::where('business_type', \App\Classes\ValueObjects\Constants\BusinessType::CURRENCY_VENDOR)->get();

        foreach ($suppliers as $supplier) {
            if(in_array($supplier->name, ['ATVANTIC IMPORT EXPORT SDN BHD', 'Atvantic - JACK'])) $supplier->reference = 'ATVANTIC IMPORT EXPORT SDN BHD (1309816-P)';
            if(in_array($supplier->name, ['BK GEMILANG SDN BHD', 'BK GEMILANG - JACK'])) $supplier->reference = 'BK GEMILANG SDN BHD (1403513-U)';
            if(in_array($supplier->name, ['YSN - Teh', 'YSN Solution Trading Sdn Bhd - Teh', 'YSN Solution Trading Sdn Bhd', 'YSN SOLUTION TRADING SDN BHD - Jack'])) $supplier->reference = 'YSN Solution Trading Sdn Bhd (1393892-D)';
            if(in_array($supplier->name, ['RACK SOLUTION INDUSTRIES SDN BHD'])) $supplier->reference = 'RACK SOLUTION INDUSTRIES SDN BHD (954723-W)';
            if(in_array($supplier->name, ['RACK SOLUTION INDUSTRIES SDN BHD'])) $supplier->reference = 'RACK SOLUTION INDUSTRIES SDN BHD (954723-W)';
            if(in_array($supplier->name, ['OFY UNION SDN BHD'])) $supplier->reference = 'OFY UNION SDN BHD (1410695-H)';
            if(in_array($supplier->name, ['Simply Infantry Sdn. Bhd.', 'SIMPLY INFANTRY SDN. BHD. - JACK'])) $supplier->reference = 'Simply Infantry Sdn. Bhd. (14393131-W)';
            if(in_array($supplier->name, ['HIGH HILL INTERNATIONAL MARKETING SDN BHD', 'HIGH HILL INTERNATIONAL SDN BHD - JACK'])) $supplier->reference = 'HIGH HILL INTERNATIONAL MARKETING SDN BHD (1419836-X)';
            if(in_array($supplier->name, ['CNT CARGO SDN BHD', 'CNT CARGO SDN BHD - JACK'])) $supplier->reference = 'CNT CARGO SDN BHD 202101036178(1436478-V)';
            if(in_array($supplier->name, ['WEST EXPRESS INTERNATIONAL TRADING SDN BHD'])) $supplier->reference = 'WEST EXPRESS INTERNATIONAL TRADING SDN BHD (1432178-T)';
            if(in_array($supplier->name, ['CIEF WORLDWIDE SDN. BHD.'])) $supplier->reference = 'CIEF WORLDWIDE SDN. BHD. (1134596-M)';

            $supplier->save();
        }

        DB::commit();
    }
}
