<?php
namespace OfficeBrain\Bundle\ShippingEstimatorBundle\Manager\Service;

use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\Security\Core\SecurityContext;
use Symfony\Component\Translation\Translator;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Component\HttpFoundation\Session\Flash\FlashBag;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use OfficeBrain\Bundle\ShippingEstimatorBundle\Manager\Extended as ShippingEstimatorManager;
use OfficeBrain\Bundle\ShippingEstimatorBundle\Helper as ShippingEstimatorHelper;


class FedexShippingEstimatorService{

	public  static function initFactory($entityManager,$request, $session, $productDetailService)
	{
		$type = $request->get('type','rate');
		if($type=='rate')
		{
			$classInstance = new ShippingEstimatorManager\RateFedexExtended($entityManager, $request, $session, $productDetailService);
		}
		if($type=='ship')
		{
			$classInstance = new ShippingEstimatorManager\ShipFedexExtended($entityManager, $request, $session, $productDetailService);
		}
		if($type=='track')
		{
			$classInstance = new ShippingEstimatorManager\TrackFedexExtended($entityManager, $request, $session, $productDetailService);
		}
		return $classInstance;
	}
}
