<?php

namespace App\Console\Commands\Competitions;

use App\Facades\TedImportService;
use Illuminate\Console\Command;

class ImportFromTedByPublicationNumber extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'competitions:import-from-ted-by-publication-number {publicationNumber : The TED publication number to import}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Import a specific competition from TED by its publication number';

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $publicationNumber = $this->argument('publicationNumber');

        $this->info("Importing notice with publication number: {$publicationNumber}");

        TedImportService::importByPublicationNumber($publicationNumber);

        $this->info('Done.');
        return 0;
    }
}
