<?php

namespace Database\Seeders;

use App\Models\Customer\Customer;
use App\Models\Agency\Agency;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\DB;

class CustomerSeeder extends Seeder
{
     public function run(): void
     {
          $agency = Agency::first();
          if (!$agency)
               return;

          $customers = [
               [
                    'first_name' => 'Ahmet',
                    'last_name' => 'Yılmaz',
                    'emails' => ['ahmet.yilmaz@gmail.com', 'ahmet.is@sirket.com'],
                    'phone' => '05321112233',
                    'birth_date' => '1985-05-15',
                    'gender' => 'male',
                    'national_id' => '12345678901',
                    'nationality' => 'TR',
                    'city' => 'İstanbul',
                    'district' => 'Beşiktaş',
                    'customer_type' => 'individual',
                    'status' => 'active',
                    'priority' => true,
                    'customer_segment' => 'vip',
               ],
               [
                    'first_name' => 'Ayşe',
                    'last_name' => 'Demir',
                    'emails' => ['ayse.demir@hotmail.com'],
                    'phone' => '05332223344',
                    'birth_date' => '1990-08-20',
                    'gender' => 'female',
                    'national_id' => '23456789012',
                    'nationality' => 'TR',
                    'city' => 'Ankara',
                    'district' => 'Çankaya',
                    'customer_type' => 'individual',
                    'status' => 'active',
                    'priority' => false,
                    'customer_segment' => 'regular',
               ],
               [
                    'first_name' => 'Mehmet',
                    'last_name' => 'Kaya',
                    'emails' => ['mehmet.kaya@outlook.com'],
                    'phone' => '05443334455',
                    'birth_date' => '1978-03-10',
                    'gender' => 'male',
                    'nationality' => 'TR',
                    'city' => 'İzmir',
                    'district' => 'Konak',
                    'customer_type' => 'individual',
                    'status' => 'active',
                    'priority' => false,
                    'customer_segment' => 'occasional',
               ],
               [
                    'first_name' => 'Fatma',
                    'last_name' => 'Şahin',
                    'emails' => ['fatma.sahin@gmail.com'],
                    'phone' => '05554445566',
                    'birth_date' => '1995-12-05',
                    'gender' => 'female',
                    'nationality' => 'TR',
                    'city' => 'Antalya',
                    'district' => 'Muratpaşa',
                    'customer_type' => 'individual',
                    'status' => 'active',
                    'priority' => true,
                    'customer_segment' => 'frequent',
               ],
               [
                    'first_name' => 'Can',
                    'last_name' => 'Öztürk',
                    'emails' => ['can.ozturk@company.com', 'can.ozturk@gmail.com', 'bilgi@teknoloji.as'],
                    'phone' => '02123334455',
                    'customer_type' => 'corporate',
                    'company_name' => 'Teknoloji A.Ş.',
                    'company_type' => 'joint_stock_company',
                    'company_tax_number' => '1234567890',
                    'company_tax_office' => 'Boğaziçi',
                    'company_position' => 'Satın Alma Müdürü',
                    'billing_address' => 'Levent Plaza No:45 Kat:12',
                    'billing_city' => 'İstanbul',
                    'billing_district' => 'Beşiktaş',
                    'billing_tax_number' => '1234567890',
                    'billing_tax_office' => 'Boğaziçi',
                    'billing_email' => 'fatura@teknoloji.as',
                    'status' => 'active',
                    'priority' => true,
                    'customer_segment' => 'vip',
               ],
               [
                    'first_name' => 'John',
                    'last_name' => 'Doe',
                    'emails' => ['john.doe@yahoo.com', 'j.doe@icloud.com'],
                    'phone' => '+447711223344',
                    'birth_date' => '1982-01-25',
                    'gender' => 'male',
                    'passport_number' => 'G1234567',
                    'nationality' => 'GB',
                    'city' => 'London',
                    'country' => 'GB',
                    'customer_type' => 'individual',
                    'status' => 'active',
                    'priority' => false,
                    'customer_segment' => 'regular',
               ],
               [
                    'first_name' => 'Elif',
                    'last_name' => 'Aydın',
                    'emails' => ['elif.aydin@gmail.com'],
                    'phone' => '05366667788',
                    'birth_date' => '1988-06-30',
                    'gender' => 'female',
                    'nationality' => 'TR',
                    'city' => 'Bursa',
                    'district' => 'Nilüfer',
                    'customer_type' => 'individual',
                    'status' => 'inactive',
                    'priority' => false,
                    'customer_segment' => 'occasional',
               ],
               [
                    'first_name' => 'Burak',
                    'last_name' => 'Çelik',
                    'emails' => ['burak.celik@hotmail.com'],
                    'phone' => '05377778899',
                    'birth_date' => '1992-11-12',
                    'gender' => 'male',
                    'nationality' => 'TR',
                    'city' => 'Trabzon',
                    'district' => 'Ortahisar',
                    'customer_type' => 'individual',
                    'status' => 'active',
                    'priority' => false,
                    'customer_segment' => 'frequent',
               ],
               [
                    'first_name' => 'Selin',
                    'last_name' => 'Koç',
                    'emails' => ['selin.koc@gmail.com'],
                    'phone' => '05388889900',
                    'birth_date' => '1984-09-18',
                    'gender' => 'female',
                    'nationality' => 'TR',
                    'city' => 'Muğla',
                    'district' => 'Bodrum',
                    'customer_type' => 'individual',
                    'status' => 'active',
                    'priority' => true,
                    'customer_segment' => 'vip',
               ],
               [
                    'first_name' => 'Ali',
                    'last_name' => 'Veli',
                    'emails' => ['ali.veli@test.com'],
                    'phone' => '05399990011',
                    'customer_type' => 'individual',
                    'status' => 'active',
                    'priority' => false,
                    'customer_segment' => 'regular',
               ],
          ];

          foreach ($customers as $customerData) {
               Customer::create(array_merge($customerData, [
                    'agency_id' => $agency->id,
                    'tags' => ['gezi', 'kültür'],
                    'interests' => ['tarih', 'doğa'],
               ]));
          }

          $this->command->info('10 adet Müşteri başarıyla eklendi!');
     }
}
