<?php

namespace App\Console\Commands;

use App\Services\Meet\MeetBillingService;
use Illuminate\Console\Command;

class ProcessMeetBillingCommand extends Command
{
    protected $signature = 'meet:process-billing';

    protected $description = 'Renew monthly Meet recording and file storage billing';

    public function handle(MeetBillingService $billing): int
    {
        $result = $billing->processDueStorageRenewals();

        $this->info(sprintf(
            'Meet storage billing: %d renewed, %d entered grace, %d deleted.',
            $result['renewed'],
            $result['graced'],
            $result['deleted'],
        ));

        return self::SUCCESS;
    }
}
