<?php

namespace Database\Seeders;

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

class AdditionalWorkingAreasSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        // إضافة مناطق عمل إضافية بدون محافظات
        $additionalAreas = [
            [
                'city_name' => 'Baghdad Central',
                'city_name_ar' => 'وسط بغداد',
                'province' => 'Baghdad',
                'province_ar' => 'بغداد',
                'center_lat' => 33.3152,
                'center_lng' => 44.3661,
                'zoom_level' => 13,
                'boundaries' => json_encode([
                    'north' => 33.4,
                    'south' => 33.2,
                    'east' => 44.4,
                    'west' => 44.3,
                ]),
                'description' => 'منطقة وسط بغداد - الكرخ والرصافة',
                'is_active' => true,
            ],
            [
                'city_name' => 'Basra Port',
                'city_name_ar' => 'ميناء البصرة',
                'province' => 'Basra',
                'province_ar' => 'البصرة',
                'center_lat' => 30.5000,
                'center_lng' => 47.8167,
                'zoom_level' => 12,
                'boundaries' => json_encode([
                    'north' => 30.6,
                    'south' => 30.4,
                    'east' => 47.9,
                    'west' => 47.7,
                ]),
                'description' => 'منطقة ميناء البصرة والمناطق المحيطة',
                'is_active' => true,
            ],
            [
                'city_name' => 'Najaf Holy',
                'city_name_ar' => 'النجف الأشرف',
                'province' => 'Najaf',
                'province_ar' => 'النجف',
                'center_lat' => 32.0000,
                'center_lng' => 44.3333,
                'zoom_level' => 12,
                'boundaries' => json_encode([
                    'north' => 32.1,
                    'south' => 31.9,
                    'east' => 44.4,
                    'west' => 44.2,
                ]),
                'description' => 'منطقة النجف الأشرف المقدسة',
                'is_active' => true,
            ],
            [
                'city_name' => 'Karbala Holy',
                'city_name_ar' => 'كربلاء المقدسة',
                'province' => 'Karbala',
                'province_ar' => 'كربلاء',
                'center_lat' => 32.6167,
                'center_lng' => 44.0333,
                'zoom_level' => 12,
                'boundaries' => json_encode([
                    'north' => 32.7,
                    'south' => 32.5,
                    'east' => 44.1,
                    'west' => 43.9,
                ]),
                'description' => 'منطقة كربلاء المقدسة',
                'is_active' => true,
            ],
            [
                'city_name' => 'Erbil City',
                'city_name_ar' => 'مدينة أربيل',
                'province' => 'Erbil',
                'province_ar' => 'أربيل',
                'center_lat' => 36.1901,
                'center_lng' => 43.9930,
                'zoom_level' => 12,
                'boundaries' => json_encode([
                    'north' => 36.3,
                    'south' => 36.1,
                    'east' => 44.1,
                    'west' => 43.9,
                ]),
                'description' => 'مدينة أربيل عاصمة إقليم كردستان',
                'is_active' => true,
            ],
        ];

        foreach ($additionalAreas as $areaData) {
            // فحص إذا كانت المنطقة موجودة بالفعل
            if (!WorkingArea::where('city_name_ar', $areaData['city_name_ar'])->exists()) {
                WorkingArea::create($areaData);
                $this->command->info('Additional working area created: ' . $areaData['city_name_ar']);
            } else {
                $this->command->info('Additional working area already exists: ' . $areaData['city_name_ar']);
            }
        }

        $this->command->info('All additional working areas processed successfully!');
    }
}
