<?php

namespace Database\Seeders;

use App\Models\ChatCategory;
use Illuminate\Database\Seeder;
use Illuminate\Support\Str;

/**
 * ChatCategorySeeder
 *
 * Seeds the four default live chat support categories for the SSHIA
 * member support portal. These categories enable the chat routing system
 * to direct incoming conversations to the most appropriate support agent,
 * ensuring members and visitors receive timely, relevant assistance.
 *
 * Uses updateOrCreate keyed on slug for idempotency — safe to re-run.
 */
class ChatCategorySeeder extends Seeder
{
    public function run(): void
    {
        $categories = [
            [
                'name'                   => 'General Support',
                'slug'                   => 'general-support',
                'description'            => 'General inquiries, feedback, and support requests that do not fall under a specific category. Our support team is ready to assist with any questions about SSHIA services, programmes, and activities.',
                'icon'                   => 'fa-headset',
                'color'                  => '#10b981',
                'is_active'              => true,
                'sort_order'             => 1,
                'expected_response_time' => 5,
            ],
            [
                'name'                   => 'Membership Queries',
                'slug'                   => 'membership-queries',
                'description'            => 'Assistance with membership applications, renewals, category upgrades, contribution payments, and member portal access. Our membership team will guide you through every step of your SSHIA membership journey.',
                'icon'                   => 'fa-id-card',
                'color'                  => '#3b82f6',
                'is_active'              => true,
                'sort_order'             => 2,
                'expected_response_time' => 10,
            ],
            [
                'name'                   => 'Technical Support',
                'slug'                   => 'technical-support',
                'description'            => 'Technical assistance for system access issues, password resets, account problems, and platform-related difficulties. Our technical team provides prompt support to ensure uninterrupted access to all SSHIA digital services.',
                'icon'                   => 'fa-tools',
                'color'                  => '#8b5cf6',
                'is_active'              => true,
                'sort_order'             => 3,
                'expected_response_time' => 15,
            ],
            [
                'name'                   => 'Training Inquiries',
                'slug'                   => 'training-inquiries',
                'description'            => 'Information and support for training programme registration, session schedules, payment processing, certificate verification, and mentorship programme applications. Connect with our training team to advance your professional development with SSHIA.',
                'icon'                   => 'fa-graduation-cap',
                'color'                  => '#f59e0b',
                'is_active'              => true,
                'sort_order'             => 4,
                'expected_response_time' => 10,
            ],
        ];

        foreach ($categories as $data) {
            ChatCategory::updateOrCreate(
                ['slug' => $data['slug']],
                $data
            );
        }

        $this->command->info('ChatCategorySeeder: 4 chat support categories seeded successfully.');
    }
}
