<?php
namespace Database\Seeders;

use App\Models\Cities;
use App\Models\Country;
use App\Models\Emirates;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class CountryEmiratesCitySeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $country = Country::create(["name"=> 'United Arab Emirates']);
        $dubai   = Emirates::create(["name"=> 'Dubai', 'country_id' => $country->id]);
        $sharjah = Emirates::create(["name"=> 'Sharjah', 'country_id' => $country->id]);
        $ajman   = Emirates::create(["name"=> 'Ajman', 'country_id' => $country->id]);
        $cities  = [
            [
                'name'=>'Dubai',
                'emirate_id'=> $dubai->id
            ],[
                'name'=>'Sharjah',
                'emirate_id'=> $sharjah->id
            ],[
                'name'=>'Ajman',
                'emirate_id'=> $ajman->id
            ],[
                'name' => 'Hatta',
                'emirate_id' => $dubai->id
            ],[
                'name'=>'Kalba',
                'emirate_id' => $sharjah->id
            ],[
                'name'=>'Dibba Al-Hisn',
                'emirate_id' => $sharjah->id
            ]
        ];
        foreach ($cities as $city) {
            Cities::create($city);
        }
        $this->command->info('Country Emirates City Seeder Done');
    }
}
