<?php

namespace App\Commands;

use App\Services\Job\JobExpiryService;
use CodeIgniter\CLI\BaseCommand;
use CodeIgniter\CLI\CLI;

class JobExpiryCheck extends BaseCommand
{
    protected $group       = 'Scheduler';
    protected $name        = 'jobs:expiry-check';
    protected $description = 'Marks jobs past their expires_at date as expired and notifies the posting agency.';

    public function run(array $params)
    {
        $count = (new JobExpiryService())->runExpiryCheck();
        CLI::write("Expired {$count} job(s) and notified their agencies.", 'yellow');
    }
}
