<?php

namespace App\Console\Commands;

use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use App\Http\Controllers\Api\TaskController;
class CallApiCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'call:api';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Calls the API to get not updated lead details';

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

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        $baseUrl = config('services.api_base_url'); // Get from config/services.php
        \Log::info("Calling API at: $baseUrl/api-get-not-updated-lead-details");
        $response = Http::withHeaders([
            'Accept' => 'application/json',
        ])->get("$baseUrl/api-get-not-updated-lead-details");

        // $response = Http::withHeaders([
        //     'Accept' => 'application/json',
        // ])->get('http://127.0.0.1:8000/api/api-get-not-updated-lead-details'); 
    }
}
