<?php

use App\Services\Monitoring\PackageLimitMetrics;
use Illuminate\Foundation\Inspiring;
use Illuminate\Support\Facades\Artisan;

Artisan::command('inspire', function () {
    $this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');

Artisan::command('metrics:package-limits {--reset}', function () {
    $snapshot = PackageLimitMetrics::snapshot();

    $this->line(json_encode([
        'generated_at' => now()->toIso8601String(),
        'metrics' => $snapshot,
    ], JSON_PRETTY_PRINT));

    if ($this->option('reset')) {
        PackageLimitMetrics::reset();
        $this->comment('Package limit metrics cache was reset.');
    }
})->purpose('Inspect package limit monitoring counters and optionally reset them');
