<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;
use Carbon\Carbon;

class JurisdictionsSeeder extends Seeder
{
    public function run()
    {
        $now = Carbon::now();
        
        $jurisdictions = [
            // Federal
            ['code' => 'FED', 'name' => 'Federal', 'display_name' => 'Federal', 'type' => 'federal', 'active' => true],
            
            // Provinces
            ['code' => 'ON', 'name' => 'Ontario', 'display_name' => 'Ontario', 'type' => 'provincial', 'active' => true],
            ['code' => 'BC', 'name' => 'British Columbia', 'display_name' => 'British Columbia', 'type' => 'provincial', 'active' => true],
            ['code' => 'AB', 'name' => 'Alberta', 'display_name' => 'Alberta', 'type' => 'provincial', 'active' => true],
            ['code' => 'QC', 'name' => 'Quebec', 'display_name' => 'Quebec', 'type' => 'provincial', 'active' => true],
            ['code' => 'SK', 'name' => 'Saskatchewan', 'display_name' => 'Saskatchewan', 'type' => 'provincial', 'active' => true],
            ['code' => 'MB', 'name' => 'Manitoba', 'display_name' => 'Manitoba', 'type' => 'provincial', 'active' => true],
            ['code' => 'NB', 'name' => 'New Brunswick', 'display_name' => 'New Brunswick', 'type' => 'provincial', 'active' => true],
            ['code' => 'NS', 'name' => 'Nova Scotia', 'display_name' => 'Nova Scotia', 'type' => 'provincial', 'active' => true],
            ['code' => 'PE', 'name' => 'Prince Edward Island', 'display_name' => 'Prince Edward Island', 'type' => 'provincial', 'active' => true],
            ['code' => 'NL', 'name' => 'Newfoundland and Labrador', 'display_name' => 'Newfoundland and Labrador', 'type' => 'provincial', 'active' => true],
            
            // Territories
            ['code' => 'YT', 'name' => 'Yukon', 'display_name' => 'Yukon', 'type' => 'territorial', 'active' => true],
            ['code' => 'NT', 'name' => 'Northwest Territories', 'display_name' => 'Northwest Territories', 'type' => 'territorial', 'active' => true],
            ['code' => 'NU', 'name' => 'Nunavut', 'display_name' => 'Nunavut', 'type' => 'territorial', 'active' => true],
        ];

        foreach ($jurisdictions as $jurisdiction) {
            DB::table('jurisdictions')->insert(array_merge($jurisdiction, [
                'created_at' => $now,
                'updated_at' => $now,
            ]));
        }

        $this->command->info('✅ Jurisdictions seeded successfully! (14 records)');
    }
}
