<?php

namespace Database\Seeders;

use App\Models\Customer;
use App\Models\ShippingEntry;
use Illuminate\Database\Seeder;

class ShippingEntrySeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        foreach (Customer::all() as $customer) {
            if ($customer->company_name === 'Genumark') {
                ShippingEntry::factory([
                    'account_title'    => 'Genumark',
                    'courier'          => 'UPS CampusShip',
                    'contact'          => 'https://www.ups.com/lasso/login',
                    'account_username' => 'GenumarkTopNotch',
                    'account_password' => 'TopNotch@13579',
                    'info_needed'      => 'Put PO on box',
                    'notify'           => 'Various reps, CC Kathlyn Wood',
                    'notes'            => 'For Save On Foods orders, see Genumark SOF',
                ])->for($customer)->create();

                ShippingEntry::factory([
                    'account_title'    => 'Genumark Save-On-Foods',
                    'courier'          => 'UPS CampusShip',
                    'contact'          => 'https://www.ups.com/lasso/login',
                    'account_username' => 'GenumarkTopNotch',
                    'account_password' => 'TopNotch@13579',
                    'info_needed'      => 'Put PO on box',
                    'notify'           => 'Jane Wellman',
                    'notes'            => 'Don\'t CC Kathlyn for SOF orders',
                ])->for($customer)->create();
            } else {
                ShippingEntry::factory(rand(0, 2), ['customer_id' => $customer->id])->create();
            }
        }
    }
}