<?php

namespace Database\Seeders;

use App\Models\TaxTable;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class TaxTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $taxTableSeed = [
            [
                'period' => 'daily',
                'compensation_range' => '684.99',
                'prescribed_withholding_tax' => '0.00',
                'percentage' => '0',
            ],
            [
                'period' => 'daily',
                'compensation_range' => '685',
                'prescribed_withholding_tax' => '0.00',
                'percentage' => '15',
            ],
            [
                'period' => 'daily',
                'compensation_range' => '1096',
                'prescribed_withholding_tax' => '61.65',
                'percentage' => '20',
            ],
            [
                'period' => 'daily',
                'compensation_range' => '2192',
                'prescribed_withholding_tax' => '280.85',
                'percentage' => '25',
            ],
            [
                'period' => 'daily',
                'compensation_range' => '5479',
                'prescribed_withholding_tax' => '1102.60',
                'percentage' => '30',
            ],
            [
                'period' => 'daily',
                'compensation_range' => '21918',
                'prescribed_withholding_tax' => '6034',
                'percentage' => '35',
            ],

            // WEEKLY
            [
                'period' => 'weekly',
                'compensation_range' => '4807.99',
                'prescribed_withholding_tax' => '0.00',
                'percentage' => '0',
            ],
            [
                'period' => 'weekly',
                'compensation_range' => '4808',
                'prescribed_withholding_tax' => '0.00',
                'percentage' => '15',
            ],
            [
                'period' => 'weekly',
                'compensation_range' => '7692',
                'prescribed_withholding_tax' => '432.60',
                'percentage' => '20',
            ],
            [
                'period' => 'weekly',
                'compensation_range' => '15385',
                'prescribed_withholding_tax' => '1971.20',
                'percentage' => '25',
            ],
            [
                'period' => 'weekly',
                'compensation_range' => '38462',
                'prescribed_withholding_tax' => '7740.45',
                'percentage' => '30',
            ],
            [
                'period' => 'weekly',
                'compensation_range' => '153846',
                'prescribed_withholding_tax' => '42355.65',
                'percentage' => '35',
            ],

            // Semi-monthly
            [
                'period' => 'semi-monthly',
                'compensation_range' => '10416.99',
                'prescribed_withholding_tax' => '0.00',
                'percentage' => '0',
            ],
            [
                'period' => 'semi-monthly',
                'compensation_range' => '10417',
                'prescribed_withholding_tax' => '0.00',
                'percentage' => '15',
            ],
            [
                'period' => 'semi-monthly',
                'compensation_range' => '16667',
                'prescribed_withholding_tax' => '937.50',
                'percentage' => '20',
            ],
            [
                'period' => 'semi-monthly',
                'compensation_range' => '33333',
                'prescribed_withholding_tax' => '4270.70',
                'percentage' => '25',
            ],
            [
                'period' => 'semi-monthly',
                'compensation_range' => '83333',
                'prescribed_withholding_tax' => '16770.70',
                'percentage' => '30',
            ],
            [
                'period' => 'semi-monthly',
                'compensation_range' => '333333',
                'prescribed_withholding_tax' => '91770.70',
                'percentage' => '35',
            ],

            // Monthly
            [
                'period' => 'monthly',
                'compensation_range' => '20832.99',
                'prescribed_withholding_tax' => '0.00',
                'percentage' => '0',
            ],
            [
                'period' => 'monthly',
                'compensation_range' => '20833',
                'prescribed_withholding_tax' => '0.00',
                'percentage' => '15',
            ],
            [
                'period' => 'monthly',
                'compensation_range' => '33333',
                'prescribed_withholding_tax' => '1875',
                'percentage' => '20',
            ],
            [
                'period' => 'monthly',
                'compensation_range' => '66667',
                'prescribed_withholding_tax' => '8541.80',
                'percentage' => '25',
            ],
            [
                'period' => 'monthly',
                'compensation_range' => '166667',
                'prescribed_withholding_tax' => '33541.80',
                'percentage' => '30',
            ],
            [
                'period' => 'monthly',
                'compensation_range' => '666667',
                'prescribed_withholding_tax' => '183541.80',
                'percentage' => '35',
            ],
        ];

        TaxTable::insert($taxTableSeed);
    }

    public function reset()
    {
        TaxTable::truncate();
    }
}
