<?php

namespace App\Http\Controllers\Hub;

use App\Http\Controllers\Controller;
use App\Services\WhmcsServices;

class HubRedirectionController extends Controller
{
    protected WhmcsServices $whmcsServices;
    public function __construct(WhmcsServices $whmcsServices)
    {
        $this->whmcsServices = $whmcsServices;
    }


    public function GoToHub(){

        $clientId = $this->getClient();

        return $this->whmcsServices->LoginClientsToTheirProfileByClientId($clientId['client_id']);
     }
     
     public function GoToHubCart(){
          $clientId = $this->getClient();
          return $this->whmcsServices->LoginClientsToTheirCarts($clientId['client_id']);
     }


    protected function getClient(){
        return $this->whmcsServices->getClientByEmail(auth()->user()->email);
    }

}
