<?php

namespace App\Support;

use Illuminate\Support\Str;

class NigeriaStates
{
    public static function all(): array
    {
        return [
            ['name' => 'Abia', 'state_code' => 'ABI', 'latitude' => 5.4527, 'longitude' => 7.5248, 'traffic_level' => 'medium'],
            ['name' => 'Adamawa', 'state_code' => 'ADA', 'latitude' => 9.3265, 'longitude' => 12.3984, 'traffic_level' => 'medium'],
            ['name' => 'Akwa Ibom', 'state_code' => 'AKW', 'latitude' => 5.0079, 'longitude' => 7.8492, 'traffic_level' => 'medium'],
            ['name' => 'Anambra', 'state_code' => 'ANA', 'latitude' => 6.2209, 'longitude' => 6.9369, 'traffic_level' => 'high'],
            ['name' => 'Bauchi', 'state_code' => 'BAU', 'latitude' => 10.3158, 'longitude' => 9.8442, 'traffic_level' => 'medium'],
            ['name' => 'Bayelsa', 'state_code' => 'BAY', 'latitude' => 4.7719, 'longitude' => 6.0699, 'traffic_level' => 'low'],
            ['name' => 'Benue', 'state_code' => 'BEN', 'latitude' => 7.1904, 'longitude' => 8.1341, 'traffic_level' => 'medium'],
            ['name' => 'Borno', 'state_code' => 'BOR', 'latitude' => 11.8846, 'longitude' => 13.1510, 'traffic_level' => 'medium'],
            ['name' => 'Cross River', 'state_code' => 'CRS', 'latitude' => 5.8702, 'longitude' => 8.5988, 'traffic_level' => 'medium'],
            ['name' => 'Delta', 'state_code' => 'DEL', 'latitude' => 5.7040, 'longitude' => 5.9339, 'traffic_level' => 'high'],
            ['name' => 'Ebonyi', 'state_code' => 'EBO', 'latitude' => 6.2649, 'longitude' => 8.0137, 'traffic_level' => 'medium'],
            ['name' => 'Edo', 'state_code' => 'EDO', 'latitude' => 6.3350, 'longitude' => 5.6037, 'traffic_level' => 'high'],
            ['name' => 'Ekiti', 'state_code' => 'EKI', 'latitude' => 7.7190, 'longitude' => 5.3110, 'traffic_level' => 'medium'],
            ['name' => 'Enugu', 'state_code' => 'ENU', 'latitude' => 6.5244, 'longitude' => 7.5086, 'traffic_level' => 'medium'],
            ['name' => 'FCT Abuja', 'state_code' => 'FCT', 'latitude' => 9.0765, 'longitude' => 7.3986, 'traffic_level' => 'high'],
            ['name' => 'Gombe', 'state_code' => 'GOM', 'latitude' => 10.2897, 'longitude' => 11.1673, 'traffic_level' => 'medium'],
            ['name' => 'Imo', 'state_code' => 'IMO', 'latitude' => 5.5720, 'longitude' => 7.0588, 'traffic_level' => 'high'],
            ['name' => 'Jigawa', 'state_code' => 'JIG', 'latitude' => 12.2280, 'longitude' => 9.5616, 'traffic_level' => 'low'],
            ['name' => 'Kaduna', 'state_code' => 'KAD', 'latitude' => 10.5105, 'longitude' => 7.4165, 'traffic_level' => 'high'],
            ['name' => 'Kano', 'state_code' => 'KAN', 'latitude' => 11.9990, 'longitude' => 8.5310, 'traffic_level' => 'high'],
            ['name' => 'Katsina', 'state_code' => 'KAT', 'latitude' => 12.3797, 'longitude' => 7.6306, 'traffic_level' => 'medium'],
            ['name' => 'Kebbi', 'state_code' => 'KEB', 'latitude' => 12.4539, 'longitude' => 4.1975, 'traffic_level' => 'low'],
            ['name' => 'Kogi', 'state_code' => 'KOG', 'latitude' => 7.8000, 'longitude' => 6.7333, 'traffic_level' => 'medium'],
            ['name' => 'Kwara', 'state_code' => 'KWA', 'latitude' => 8.9669, 'longitude' => 4.3874, 'traffic_level' => 'medium'],
            ['name' => 'Lagos', 'state_code' => 'LAG', 'latitude' => 6.5244, 'longitude' => 3.3792, 'traffic_level' => 'critical'],
            ['name' => 'Nasarawa', 'state_code' => 'NAS', 'latitude' => 8.4998, 'longitude' => 8.1997, 'traffic_level' => 'medium'],
            ['name' => 'Niger', 'state_code' => 'NIG', 'latitude' => 9.9309, 'longitude' => 5.5983, 'traffic_level' => 'medium'],
            ['name' => 'Ogun', 'state_code' => 'OGU', 'latitude' => 7.1600, 'longitude' => 3.3500, 'traffic_level' => 'high'],
            ['name' => 'Ondo', 'state_code' => 'OND', 'latitude' => 7.1000, 'longitude' => 5.0833, 'traffic_level' => 'medium'],
            ['name' => 'Osun', 'state_code' => 'OSU', 'latitude' => 7.5629, 'longitude' => 4.5200, 'traffic_level' => 'medium'],
            ['name' => 'Oyo', 'state_code' => 'OYO', 'latitude' => 7.8500, 'longitude' => 3.9300, 'traffic_level' => 'high'],
            ['name' => 'Plateau', 'state_code' => 'PLA', 'latitude' => 9.2182, 'longitude' => 9.5179, 'traffic_level' => 'medium'],
            ['name' => 'Rivers', 'state_code' => 'RIV', 'latitude' => 4.8581, 'longitude' => 6.9209, 'traffic_level' => 'high'],
            ['name' => 'Sokoto', 'state_code' => 'SOK', 'latitude' => 13.0059, 'longitude' => 5.2476, 'traffic_level' => 'medium'],
            ['name' => 'Taraba', 'state_code' => 'TAR', 'latitude' => 7.9869, 'longitude' => 10.9807, 'traffic_level' => 'medium'],
            ['name' => 'Yobe', 'state_code' => 'YOB', 'latitude' => 12.2939, 'longitude' => 11.4390, 'traffic_level' => 'low'],
            ['name' => 'Zamfara', 'state_code' => 'ZAM', 'latitude' => 12.1844, 'longitude' => 6.2376, 'traffic_level' => 'medium'],
        ];
    }

    public static function withSlugs(): array
    {
        return array_map(static function (array $state): array {
            $state['slug'] = Str::slug($state['name']);
            $state['zoom_level'] = $state['name'] === 'Lagos' ? 11 : 8;
            $state['traffic_summary'] = 'State traffic monitoring baseline for '.$state['name'].'. Update this from live traffic feeds when the provider is connected.';

            return $state;
        }, self::all());
    }
}
