<?php

namespace Database\Seeders;

use App\Models\Communication\CallQueue;
use App\Models\Solicitor\Solicitor;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

class CallQueueSeeder extends Seeder
{
    public function run(): void
    {
        Solicitor::query()->each(function (Solicitor $solicitor) {
            foreach ([
                         ['name' => 'Client Queue', 'type' => 'client'],
                         ['name' => 'External Queue', 'type' => 'external'],
                         ['name' => 'General Intake Queue', 'type' => 'intake'],
                     ] as $queue) {
                CallQueue::query()->firstOrCreate([
                    'solicitor_id' => $solicitor->id,
                    'type' => $queue['type'],
                ], [
                    'name' => $queue['name'],
                    'priority' => 100,
                    'is_active' => true,
                ]);
            }
        });
    }
}