<?php

namespace App\Console\Commands;

use App\Libs\Services\TwintagSyncService;
use Illuminate\Console\Command;

class SyncTwintag extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'twintag:sync {--force : Force sync}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Syncs all projects with SP API';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle(TwintagSyncService $service)
    {
        $forceSync = $this->option('force');
        $service->syncCompanies($forceSync);
        $service->syncTwintags($forceSync);
        return 0;
    }
}
