<?php

namespace Database\Seeders;

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

class AdditionalNassiriyaAreasSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        // إضافة مناطق عمل إضافية في الناصرية
        $additionalAreas = [
            [
                'city_name' => 'Nassiriya Center',
                'city_name_ar' => 'وسط الناصرية',
                'province' => 'Dhi Qar',
                'province_ar' => 'ذي قار',
                'center_lat' => 31.0437,
                'center_lng' => 46.2575,
                'zoom_level' => 13,
                'boundaries' => json_encode([
                    'north' => 31.05,
                    'south' => 31.04,
                    'east' => 46.26,
                    'west' => 46.25,
                ]),
                'description' => 'منطقة وسط الناصرية - السوق المركزي والمناطق التجارية',
                'is_active' => true,
            ],
            [
                'city_name' => 'Nassiriya University',
                'city_name_ar' => 'جامعة الناصرية',
                'province' => 'Dhi Qar',
                'province_ar' => 'ذي قار',
                'center_lat' => 31.0500,
                'center_lng' => 46.2600,
                'zoom_level' => 14,
                'boundaries' => json_encode([
                    'north' => 31.06,
                    'south' => 31.04,
                    'east' => 46.27,
                    'west' => 46.25,
                ]),
                'description' => 'منطقة جامعة الناصرية والمناطق المحيطة',
                'is_active' => true,
            ],
            [
                'city_name' => 'Nassiriya Industrial',
                'city_name_ar' => 'المنطقة الصناعية',
                'province' => 'Dhi Qar',
                'province_ar' => 'ذي قار',
                'center_lat' => 31.0400,
                'center_lng' => 46.2500,
                'zoom_level' => 12,
                'boundaries' => json_encode([
                    'north' => 31.05,
                    'south' => 31.03,
                    'east' => 46.26,
                    'west' => 46.24,
                ]),
                '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 Nassiriya area created: ' . $areaData['city_name_ar']);
            } else {
                $this->command->info('Additional Nassiriya area already exists: ' . $areaData['city_name_ar']);
            }
        }

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