<?php

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

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');

Schedule::command('model:prune', [
    '--model' => [SuperAdminActionLog::class],
])->daily();

Schedule::command('tenant-announcements:dispatch')->everyFiveMinutes();
