<?php

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

// Scheduler: Integracao Vetor ↔ Bling
Schedule::call(function () {
    // Executa sincronização de estoque (Vetor → Bling)
    app(\App\Jobs\SyncStockJob::class)
        ->handle(app(\App\Services\BlingClient::class), app(\App\Services\VetorClient::class));
})->cron('0 */4 * * *')->name('sync-stock');

Schedule::call(function () {
    // Importa pedidos faturados (Bling → Vetor)
    app(\App\Jobs\ImportOrdersJob::class)
        ->handle(app(\App\Services\BlingClient::class), app(\App\Services\VetorClient::class));
})->everyFifteenMinutes()->name('import-orders');
