<?php

namespace App\Console\Commands;

use App\Jobs\UpdateCurrencyRates;
use Illuminate\Console\Command;

class UpdateCurrencyRatesCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'currencies:update-rates';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Aktif para birimlerinin kurlarını güncel tutmak için API\'den veri çeker';

    /**
     * Execute the console command.
     */
    public function handle()
    {
        $this->info(__('console.currency_rates_updating'));

        // Job'ı hemen çalıştır
        UpdateCurrencyRates::dispatchSync();

        $this->info(__('console.currency_rates_updated'));

        return Command::SUCCESS;
    }
}
