<?php

namespace Database\Seeders;

use App\Models\ClientGroup;
use Illuminate\Database\Seeder;

class ClientGroupSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $clientGroups = [
            [
                'group_name' => 'Standard',
                'text_color' => '#6c757d',
                'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'group_name' => 'Bronze',
                'text_color' => '#cd7f32',
                'tax_exempt' => true,
                'custom_pricing_enabled' => true,
                'pricing_type' => 'override_specific',
                'pricing_rules' => ['discount_percentage' => null, 'discount_amount' => null],
                'pricing_overrides' => [
                    'products' => ['3' => ['monthly' => 5]],
                    'tlds' => ['8' => ['register' => ['1' => 2]]],
                ],
                'notification_settings' => [
                    'client_signup' => '1',
                    'client_email_verification' => '1',
                    'client_password_reset' => '1',
                    'invoice_created' => '1',
                    'invoice_payment' => '1',
                    'invoice_payment_reminder' => '1',
                    'invoice_overdue' => '1',
                    'invoice_cancelled' => '1',
                    'invoice_refund' => '1',
                    'product_welcome' => '1',
                    'product_provisioned' => '1',
                    'product_suspended' => '1',
                    'product_unsuspended' => '1',
                    'product_terminated' => '1',
                    'product_renewal' => '1',
                    'product_cancellation' => '1',
                    'domain_registered' => '1',
                    'domain_transferred' => '1',
                    'domain_renewal' => '1',
                    'domain_renewal_upcoming' => '1',
                    'domain_expired' => '1',
                ],
                'payment_terms_days' => null,
                'auto_suspend_disabled' => false,
                'override_suspend' => false,
                'override_terminate' => false,
                'allow_negative_balance' => false,
                'credit_limit' => null,
                'resource_limits' => null,
                'support_priority' => 'normal',
                'description' => null,
                'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'group_name' => 'Silver',
                'text_color' => '#C0C0C0',
                'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'group_name' => 'Gold',
                'text_color' => '#FFD700',
                'created_at' => now(),
                'updated_at' => now(),
            ],
            [
                'group_name' => 'Platinum',
                'text_color' => '#E5E4E2',
                'created_at' => now(),
                'updated_at' => now(),
            ],
        ];

        foreach ($clientGroups as $group) {
            ClientGroup::updateOrCreate(
                ['group_name' => $group['group_name']],
                $group
            );
        }
    }
}
