<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Models\User;

class CheckAdminUser extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'check:admin-user';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Check if admin user exists in database';

    /**
     * Execute the console command.
     */
    public function handle()
    {
        $adminUsers = User::where('user_type', 'admin')->get();

        if ($adminUsers->count() > 0) {
            $this->info('Admin users found:');
            foreach ($adminUsers as $user) {
                $this->line("ID: {$user->id}, Name: {$user->name}, Email: {$user->email}, Status: {$user->status}");
            }
        } else {
            $this->error('No admin users found!');
        }

        return 0;
    }
}
