<?php

namespace AppBundle\Command;

use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Bundle\FrameworkBundle\Controller\Controller,
	
	Symfony\Component\HttpFoundation\Request,
    Symfony\Component\HttpFoundation\Response;
use Happyr\LinkedIn\LinkedIn;


class OfferCommand extends ContainerAwareCommand
{
    /**
     * EntityManager
     */
    private $em;

    /**
     * @var OutputInterface
     */
    private $output;

    /**
     * Set configure
     */
    protected function configure()
    {
        $this->setName('offers:update')
            ->setDescription('Insert dummy offers in database from Linkedin. Usefull for share testing datas.');
    }


    /**
     * Execute the command
     *  - import offers from Linkedin
     * @param InputInterface $input
     * @param OutputInterface $output
     * @return void
     */
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $this->output = $output;
        $this->output->writeln(sprintf(' // Executing update offers'));
		$linkedIn = new LinkedIn('75t0na95h0xc3y', '6q97pMhX1k15uSM2');
		dump($linkedIn);

if ($linkedIn->isAuthenticated()) {
    //we know that the user is authenticated now. Start query the API
     $user = $linkedIn->get('v1/job-search:(jobs:(id,customer-job-code,active,posting-date,expiration-date,posting-timestamp,expiration-timestamp,company:(id,name),position:(title,location,job-functions,industries,job-type,experience-level),skills-and-experience,description-snippet,description,salary,job-poster:(id,first-name,last-name,headline),referral-bonus,site-job-url,location-description))?&company-name=Merck&country-code=ch');
	 $this->output->writeln(sprintf("Welcome eeee"));

} else {
	 $this->output->writeln(sprintf("User canceled the login."));
}

		

    }


  
}