<?php

use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Schedule;

Artisan::command('inspire', function (): void {
    $this->comment('Build financial tools that are clear, reliable, and accountable.');
})->purpose('Display an inspiring message');

Schedule::command('operations:scheduler-heartbeat')
    ->everyMinute()
    ->timezone((string) config('app.timezone','Africa/Dar_es_Salaam'))
    ->withoutOverlapping();

Schedule::command('loans:update-overdue')
    ->dailyAt('00:05')
    ->timezone((string) config('app.timezone','Africa/Dar_es_Salaam'))
    ->withoutOverlapping();

Schedule::command('credit-scores:refresh-stale')
    ->dailyAt((string) config('credit_score.operations.refresh_schedule_time', '02:15'))
    ->timezone((string) config('app.timezone','Africa/Dar_es_Salaam'))
    ->withoutOverlapping();

Schedule::command('management:process-work')
    ->dailyAt('07:00')
    ->timezone((string) config('app.timezone','Africa/Dar_es_Salaam'))
    ->withoutOverlapping();

Schedule::command('expenses:process-recurring')
    ->dailyAt('07:30')
    ->timezone((string) config('app.timezone','Africa/Dar_es_Salaam'))
    ->withoutOverlapping();

Schedule::command('notifications:dispatch-reminders')
    ->dailyAt((string) config('reminders.dispatch_time','08:00'))
    ->timezone((string) config('app.timezone','Africa/Dar_es_Salaam'))
    ->withoutOverlapping();

if ((bool) config('backups.schedule_enabled', false)) {
    Schedule::command('security:backup')
        ->dailyAt((string) config('backups.schedule_time', '01:30'))
        ->timezone((string) config('app.timezone', 'Africa/Dar_es_Salaam'))
        ->withoutOverlapping();
}
