<?php

namespace Database\Seeders;

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

class RegistrarSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $registrars = [
            [
                'name' => 'namecheap',
                'module_data' => json_encode([
                    'type' => 'namecheap',
                    'description' => 'Namecheap Domain Registrar',
                ]),
                'status' => 'active',
            ],
            [
                'name' => 'resellerclub',
                'module_data' => json_encode([
                    'type' => 'resellerclub',
                    'description' => 'ResellerClub Domain Registrar',
                ]),
                'status' => 'active',
            ],
            [
                'name' => 'dummyregistrar',
                'module_data' => json_encode([
                    'type' => 'dummyregistrar',
                    'description' => 'Dummy Registrar for Testing (Webhook Integration)',
                ]),
                'status' => 'active',
            ],
            [
                'name' => 'email',
                'module_data' => json_encode([
                    'type' => 'email',
                    'description' => 'Internal Email Module (Non-deletable)',
                ]),
                'status' => 'active',
            ],
        ];

        foreach ($registrars as $registrar) {
            Registrar::updateOrCreate(
                ['name' => $registrar['name']],
                $registrar
            );
        }
    }
}
