<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use App\Http\Controllers\CertificatesController;

class UpdateExpiredStatus extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'command:updateexpiredcerts';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Update the status of certified members if their expiry date has passed';

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        // Instantiate the controller
        $controller = new CertificatesController();

        // Call the updateExpiredStatus method
        $controller->updateExpiredStatus();

        // Output a message to the console
        $this->info('Expired statuses updated successfully.');

        return 0;

        return Command::SUCCESS;
    }
}
