<?php

declare(strict_types=1);

use Hyperf\Database\Seeders\Seeder;

class RequestTypeSeeder extends Seeder
{
    public function run(): void
    {
        $types = [
            [
                'name'              => 'Barangay Clearance',
                'code'              => 'CLEARANCE',
                'description'       => 'General purpose barangay clearance for various applications.',
                'base_fee'          => 50.00,
                'processing_days'   => 1,
                'is_active'         => true,
                'requires_clearance' => false,
            ],
            [
                'name'              => 'Certificate of Residency',
                'code'              => 'RESIDENCY',
                'description'       => 'Proof of residency within the barangay.',
                'base_fee'          => 30.00,
                'processing_days'   => 1,
                'is_active'         => true,
                'requires_clearance' => false,
            ],
            [
                'name'              => 'Certificate of Indigency',
                'code'              => 'INDIGENCY',
                'description'       => 'Certification for indigent residents for government assistance.',
                'base_fee'          => 0.00,
                'processing_days'   => 1,
                'is_active'         => true,
                'requires_clearance' => false,
            ],
            [
                'name'              => 'Certificate of Good Moral Character',
                'code'              => 'GOOD_MORAL',
                'description'       => 'Character reference certificate from the barangay.',
                'base_fee'          => 50.00,
                'processing_days'   => 2,
                'is_active'         => true,
                'requires_clearance' => false,
            ],
            [
                'name'              => 'Business Clearance',
                'code'              => 'BUSINESS_CLEARANCE',
                'description'       => 'Barangay clearance for business registration and renewal.',
                'base_fee'          => 200.00,
                'processing_days'   => 3,
                'is_active'         => true,
                'requires_clearance' => false,
            ],
            [
                'name'              => 'Closure of Business',
                'code'              => 'BUSINESS_CLOSURE',
                'description'       => 'Certification for business closure.',
                'base_fee'          => 100.00,
                'processing_days'   => 3,
                'is_active'         => true,
                'requires_clearance' => false,
            ],
            [
                'name'              => 'Solo Parent ID',
                'code'              => 'SOLO_PARENT',
                'description'       => 'Certification for solo parent status.',
                'base_fee'          => 0.00,
                'processing_days'   => 2,
                'is_active'         => true,
                'requires_clearance' => false,
            ],
            [
                'name'              => 'Senior Citizen Assistance',
                'code'              => 'SENIOR_CITIZEN',
                'description'       => 'Certification for senior citizen benefits.',
                'base_fee'          => 0.00,
                'processing_days'   => 1,
                'is_active'         => true,
                'requires_clearance' => false,
            ],
        ];

        foreach ($types as $type) {
            \Hyperf\DbConnection\Db::table('barangay_request_types')
                ->updateOrInsert(['code' => $type['code']], array_merge($type, [
                    'created_at' => now(),
                    'updated_at' => now(),
                ]));
        }
    }
}
