<?php

namespace Modules\SystemCore\Database\Seeders;

use Illuminate\Database\Seeder;
use Modules\SystemCore\App\Models\CorePaymentTerm;

class PaymentTermSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $paymentTerms = [
            ['name' => 'Cash on Delivery', 'code' => 'COD', 'days' => 0],
            ['name' => 'Net 7', 'code' => 'NET7', 'days' => 7],
            ['name' => 'Net 15', 'code' => 'NET15', 'days' => 15],
            ['name' => 'Net 30', 'code' => 'NET30', 'days' => 30],
            ['name' => 'Net 45', 'code' => 'NET45', 'days' => 45],
            ['name' => 'Net 60', 'code' => 'NET60', 'days' => 60],
            ['name' => 'Net 90', 'code' => 'NET90', 'days' => 90],
        ];

        foreach ($paymentTerms as $term) {
            CorePaymentTerm::firstOrCreate(
                ['code' => $term['code']],
                $term
            );
        }
    }
}
