<?php

namespace OfficeBrain\Bundle\RequestQuoteBundle\Controller;

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\Translation\Translator;
use OfficeBrain\Bundle\RequestQuoteBundle\Form\RequestQuoteCommentType;
use OfficeBrain\Bundle\RequestQuoteBundle\Entity\RequestQuoteComment;
use OfficeBrain\Bundle\UserBundle\Form\ContactBookType;
use OfficeBrain\Bundle\UserBundle\Entity\ContactBook;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use OfficeBrain\Bundle\RequestQuoteBundle\Form\UploadArtWorkDetailType as UploadArtWorkDetailType;
use OfficeBrain\Bundle\RequestQuoteBundle\Form\RequestQuoteAddGuestShippingType;
use OfficeBrain\Bundle\RequestQuoteBundle\Form\GuestUserType;
use Nelmio\ApiDocBundle\Annotation\ApiDoc;
use Symfony\Component\Security\Core\Exception\AccessDeniedException;

/**
 *
 * @author Employee Id: 410175
 * OB eCommerce Product -Request Quote
 * - List All the Request Quote Inquiry
 * - Add New Request Quote Inquiry
 * @Route("/api/v1", defaults={"rule_service"="rule_charges"})
 */
class ApiRequestQuoteController extends RequestQuoteController
{
	/**
	 *
	 * @author Employee Id: 410175
	 * To set member variables default value
	 * @return NULL
	 */
	public function __construct()
	{
		parent::__construct();
		$this->responseFormat = null;
	}

	/**
	 *
	 * @author Employee Id: 410175
	 * To unset member variables
	 * @return NULL
	 */
	public function __destruct()
	{
		parent::__destruct();
		unset($this->responseFormat);
	}
	
	/**
	 *
	 * @author Employee Id: 410175
	 * Create various objects required action in this class
	 * @return NULL
	 */
	public function initAction()
	{
		parent::initAction();  
    	$this->responseFormat = $this->request->get('_format', null) ;
	}

	/*
	 * @author Employee Id: 410175
	 * Description : Use to render view to add imprint location box.
	 * @param 1 : No paramater
	 * @return type : Ajax response in view.
	 * @throws Exception: Null
	 *
	 * @Route("/{_locale}/add-imprint-location",name="office_brain_requestquotebundle_requestquote_addimprintlocation_api")
	 * 
	 * @ApiDoc(
     *      resource=true,
     *      section="Request Quote",
     *      description="To get Imprint Method from position.",
     *      requirements={     
     *      	{"name"="_locale", "dataType"="string", "default"="en_us"},
     *      	{"name"="access_token", "dataType"="string", "required"=false, "description"="valid access token"},
     *      	{"name"="imprint_location_id", "dataType"="integer", "description"="valid imprint position id"},
     *      	{"name"="product_id", "dataType"="integer", "description"="valid product id"},
     *      },
     *      statusCodes={
     *              1="Returned when success",
     *              403="Returned when the user is not authorized to see this link",
     *              0="Returned when form validation is failed",
     *      }
     * )
	 * 
	 * @Template()
	 * @Method({"POST"})
	 * /
	public function addImprintLocationAction()
	{
		$this->initAction();		
		$imprintData = $this->requestQuoteManager->addImprintLocationMobileApi();
		if($imprintData === false){
			return array('status'=>'error','status_code'=>0,'message' => 'Please enter productId & imprint location id.');
		}
		
		if($this->responseFormat == "json"){
			return array('status'=>'success','status_code'=>1,'data' => $imprintData);
		}
		return $data;
	}
	
	/**
	 * @author Employee Id: 410175
	 *
	 * Description : Use to get no of Color from selected imprint method.
	 *
	 * @param 1 : No paramater
	 *
	 * @return array : Form view and data.
	 *
	 * @throws Exception: Null
	 *
	 * @Route("/{_locale}/select-method", name="office_brain_requestquotebundle_requestquote_selectMethod_api")
	 * 
	 * @ApiDoc(
     *      resource=true,
     *      section="Request Quote",
     *      description="To get No of color from selected Imprint Method id.",
     *      requirements={     
     *      	{"name"="_locale", "dataType"="string", "default"="en_us"},
     *      	{"name"="access_token", "dataType"="string", "required"=false, "description"="valid access token"},
     *      	{"name"="imprint_id", "dataType"="integer", "description"="valid imprint position id"},
     *      	{"name"="method_id", "dataType"="integer", "description"="valid imprint method id"},
     *      	{"name"="product_id", "dataType"="integer", "description"="valid product id"},
     *      },
     *      statusCodes={
     *              1="Returned when success",
     *              403="Returned when the user is not authorized to see this link",
     *              0="Returned when form validation is failed",
     *      }
     * )
	 * 
	 * @Template()
	 * @Method({"POST"})
	 * /
	public function selectMethodAction()
	{
		$this->initAction();
		$data = $this->requestQuoteManager->selectImprintMethodMobileApi();
		
		if($this->responseFormat == "json"){
			if($data === false ){
				return array('status'=>'error','status_code'=>0,'message' => 'Please select productId, ImprintId, MethodId.');
			}
			return array('status'=>'success','status_code'=>1,'data' => $data);
		}
		
		return $data;
	}
	
	/**
	 * @author Employee Id: 410175
	 *
	 * Description : Use to show the list of product in this request quote.
	 *
	 * @param 1 : No paramater
	 *
	 * @return type : json
	 *
	 * @throws Exception: Null
	 *
	 * @Route("/{_locale}/select-color-request-quote", name="office_brain_requestquotebundle_requestquote_selectColor_api")
	 * 
	 * @ApiDoc(
     *      resource=true,
     *      section="Request Quote",
     *      description="To get standard & PMS colors.",
     *      requirements={     
     *      	{"name"="_locale", "dataType"="string", "default"="en_us"},
     *      	{"name"="access_token", "dataType"="string", "required"=false, "description"="valid access token"},
     *      	{"name"="imprint_id", "dataType"="integer", "description"="valid imprint position id"},
     *      	{"name"="product_id", "dataType"="integer", "description"="valid product id"},
     *      },
     *      statusCodes={
     *              1="Returned when success",
     *              403="Returned when the user is not authorized to see this link",
     *              0="Returned when form validation is failed",
     *      }
     * )
	 * 
	 * @Template()
	 * @Method({"POST"})
	 * /
	public function selectColorAction()
	{
		$this->initAction();
		$standardImprintColor = $this->requestQuoteManager->getStandardImprintColorInformationMobileApi();
		$pmsColor = $this->container->getParameter('pms_color');
		return array('imprint_id'=>$this->request->get('imprint_id'),'product_id'=>$this->request->get('product_id'),'standard_imprint_color'=> $standardImprintColor, 'pms_color'=>$pmsColor);
	}
	
	/**
	 * @author Employee Id: 410175
	 *
	 * Description : Use to set session data for Request Quote
	 *
	 * @param 1 : No paramater
	 *
	 * @return type : json
	 *
	 * @throws Exception: Null
	 *
	 * @Route("/{_locale}/set-request-quote-session", name="office_brain_requestquotebundle_requestquote_setrequestquotesession_api")
	 * 
	 * @ApiDoc(
     *      resource=true,
     *      section="Request Quote",
     *      description="To submit Request Quote data.",
     *      requirements={     
     *      	{"name"="_locale", "dataType"="string", "default"="en_us"},
     *      	{"name"="access_token", "dataType"="string", "required"=false, "description"="valid access token"},
     *      	{"name"="by_pass", "dataType"="string", "required"=false, "description"="set 0 or 1, set 1 to do checkout process without calling another checkout api"},
     *      },
     *      input = {
     *      	"class" = "\OfficeBrain\Bundle\OrderBundle\Form\ApiOrderType"
     *      },
     *      statusCodes={
     *              1="Returned when success",
     *              403="Returned when the user is not authorized to see this link",
     *              0="Returned when form validation is failed",
     *      }
     * )
	 * 
	 * @Method({"POST"})
	 * /
	public function setRequestQuoteSessionAction()
	{	
		if (false === $this->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
			throw new AccessDeniedException();
		}
		
		$this->initAction();
		
		$byPass = $this->request->get('by_pass',0);
		
		$convertJsonToAry = array('color','shipping_method','imprint','fax_proof','paper_proof','product_proof');
		foreach ($convertJsonToAry as $fieldName){
			if($this->request->request->has($fieldName) && $this->request->request->get($fieldName)!=null && $this->request->request->get($fieldName)!='null'){
				$fieldVal = $this->request->request->get($fieldName);
				$fieldVal = json_decode($fieldVal, true);
				$this->request->request->set($fieldName, $fieldVal);
			}
		}
		
		$this->validationManager->setMaxNoOfColor($this->request->get('max_selectable_color'));
		$this->validationManager->setProjectConfiguration($this->productDetailconfigurationRule);
		$this->validationManager->setRules('color', 'color','color');
		$this->validationManager->setRules('imprint', 'printPosition','printPosition');
		$this->validationManager->setRules('fax_proof', 'faxProof','printPositionProof');
		$this->validationManager->setRules('paper_proof', 'paperProof','printPositionProof');
		//$this->validationManager->setRules('shipping_method', 'shippingMethod','shippingMethod');// as mobile dont show shipping detail
		//$this->validationManager->setRules('special_instruction', 'required','specialInstruction');
		
		$errorMessage = null;
		$this->responseArray = null;
		if( $this->validationManager->isValid() ) {
			
			if ( $this->request->request->has('imprint') && $this->request->request->get('imprint')!=null && $this->request->request->get('imprint')!='null'){// Code to upload media image to artwork
				$imprintData = $this->request->request->get('imprint');				
				foreach ($imprintData as $imprintKey => $imprints){
					if( isset($imprints['art_work_text']) && isset($imprints['art_work_text']['logo']) ) {
						foreach ($imprints['art_work_text']['logo'] as $logoKey => $logo){
							$logoAry = explode("/",$logo);
							$logoName = '';
							if( ($logoCount = count($logoAry) ) > 1){
								$logoName = $logoAry[$logoCount-1]; 
							}else{$logoName = $logoAry[0];}
							
							$isArtWorkUploaded = $this->copyMediaImageToArtwork ($logo,$logoName);
							$imprintData[$imprintKey]['art_work_text']['logo'][$logoKey] = ($isArtWorkUploaded != null ? $isArtWorkUploaded : $logo) ;
						}
					}
				}
				$this->request->request->set('imprint',$imprintData);
			}
			
		
			$status = $this->requestQuoteManager->setPreAddToRequesQuote(); // we need to add this thing for guest user
			// End new change
	
			switch ($status) {
				case 'NO_PRODUCT_FOUND':
					$this->responseArray['status'] = 'error';
					$this->responseArray['status_code'] = 0;
					$this->responseArray['message'] = $this->get('translator')->trans('request_quote.product_not_found');
					break;
				case 'ERROR_MAX_LIMIT_REACHED':
					$this->responseArray['status'] = 'error';
					$this->responseArray['status_code'] = 0;
					$this->responseArray['message'] = $this->get('translator')->trans('request_quote.max_product_request_quote', array('%count%'=>$this->inlineViewProductMaxLimit));
					break;
				case 'ERROR_PRODUCT_ALREADY_EXISTS':
					$this->responseArray['status'] = 'error';
					$this->responseArray['status_code'] = 0;
					$this->responseArray['message'] = $this->get('translator')->trans('request_quote.product_already_exists');
					break;
				case 'SUCCESS':					
					if ( $byPass != 0 ){						
						return $this->saveRequestQuoteSessionAction();						
					}
					$this->responseArray['status'] = 'success';
					$this->responseArray['status_code'] = 1;
					$this->responseArray['data']['total_product'] = $this->requestQuoteManager->getTotalRequestQuoteCount();
					break;
			}
			
		} else {
			$this->responseArray['status'] = 'error';
			$this->responseArray['status_code'] = 0;
			$this->responseArray['message'] = $this->validationManager->isError();			
		}
		return $this->responseArray;
	}
	
	/**
	 * @author Employee Id: 410175
	 * Description : Use to get session data for Request Quote
	 *
	 * @Route("/{_locale}/list-request-quote-list", name="office_brain_requestquotebundle_requestquote_requestquotelist_api")
	 * 
	 * @ApiDoc(
     *      resource=true,
     *      section="Request Quote",
     *      description="To Get All the Request Quote products which are in Cart",
     *      requirements={
     *      	{"name"="_locale", "dataType"="string", "default"="en_us"},
     *      	{"name"="access_token", "dataType"="string", "required"=false, "description"="valid access token"},
     *      },
     *      statusCodes={
     *              1="Returned when success",
     *              403="Returned when the user is not authorized to see this link",
     *              0="Returned when form validation is failed",
     *      }
     * )
	 * 
	 * @Method({"POST"})
	 * @Template("")
	 * /
	public function listRequestQuoteSessionAction()
	{
		if (false === $this->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
			throw new AccessDeniedException();
		}
		#TODO: Guest User is remaining
		$this->initAction();
		$this->responseArray = null;
		$this->responseArray['total_record'] = $this->requestQuoteManager->getTotalRequestQuoteCount();
		
		$shippoingCartList = $this->requestQuoteManager->getPreRequestQuoteList();
		if($shippoingCartList){
			foreach ($shippoingCartList as $productId=>$product){
				if( isset($product['imprint']) && count($product['imprint'])<=0 ) $shippoingCartList[$productId]['imprint'] = null;
				if( isset($product['charges']) && count($product['charges'])<=0 ) $shippoingCartList[$productId]['charges'] = null;
				if( isset($product['split']) && count($product['split'])<=0 ) $shippoingCartList[$productId]['split'] = null;
			}
		}
		$this->responseArray['shopping_cart_list'] = $shippoingCartList ;
		
		return array('status'=>'success','status_code'=>1,'data'=>$this->responseArray);
	}
	
	/**
	 * @author Employee Id: 410175
	 * Description : Use to save session data of Request Quote
	 *
	 * @Route("/{_locale}/add-request-quote-session", name="office_brain_requestquotebundle_saverequestquotesession_api")
	 * 
	 * @ApiDoc(
     *      resource=true,
     *      section="Request Quote",
     *      description="To Save|Checkout Request Quote data to DB.",
     *      requirements={     
     *      	{"name"="_locale", "dataType"="string", "default"="en_us"},
     *      	{"name"="access_token", "dataType"="string", "required"=false, "description"="valid access token"},
     *      },
     *      statusCodes={
     *              1="Returned when success",
     *              403="Returned when the user is not authorized to see this link",
     *              0="Returned when form validation is failed",
     *      }
     * )
	 * 
	 * @Method({"POST"})
	 * /
	public function saveRequestQuoteSessionAction()
	{
		if (false === $this->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
			throw new AccessDeniedException();
		}
		#TODO: Guest User is remaining
		$this->initAction();
		
		$result = $this->requestQuoteManager->addRequestQuoteToDB();
		
		if(isset($result) && isset($result['status'])){
			if ($result['status'] == 'success') {
				
				$requestQuoteObj = $result['data'];
				if (is_array($this->erpIntegration) && $this->erpIntegration['orderManagement'] == 1 && !empty($this->queueApiManager)) {
					if ($requestQuoteObj->getGuestId() == 0) {
						$this->queueApiManager->mapQueue("create", $requestQuoteObj);
					}
				}
				$status = $this->requestQuoteManager->deleteAllRequestQuote();	
				return array('status'=>'success','status_code'=>1,'message'=>'Email has been sent.');
				
			}else if($result['status'] == 'error' && $result['error'] == 'billing_address_missing'){
				
				return array('status'=>'error','status_code'=>0,'message'=>$this->get('translator')->trans('request_quote.billing_address_error'));
			}
		}
	
		return array('status'=>'error','status_code'=>0,'message'=>'No Data added, please try again.');
	}
	
	
	/**
	 * @author Employee Id: 410175
	 * Description : use to render Select Logo Block
	 * @param 1 : No paramater
	 * @return type : Ajax response in view.
	 * @throws Exception: Null
	 *
	 * @Route("/{_locale}/select-logo-block", name="office_brain_requestquotebundle_requestquote_selectlogoblock_api")
	 * 
	 * @ApiDoc(
     *      resource=true,
     *      section="Media Library|Artwork",
     *      description="To get all the uploaded media files.",
     *      requirements={     
     *      	{"name"="_locale", "dataType"="string", "default"="en_us"},
     *      	{"name"="access_token", "dataType"="string", "required"=true, "description"="valid access token"},
     *      	{"name"="page", "dataType"="integer","default"="1", "description"="page number"},
     *      	{"name"="recordperpage", "dataType"="integer","default"="12", "description"="record per page "},
     *      },      
     *      statusCodes={
     *              1="Returned when success",
     *              403="Returned when the user is not authorized to see this link",
     *              0="Returned when form validation is failed",
     *      }
     * )
	 * 
	 * @Template()
	 * @Method({"POST"})
	 * /
	public function selectLogoBlockAction()
	{
		if (false === $this->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
			throw new AccessDeniedException();
		}
		
		$this->initAction();
		
		$page = $this->request->get('page',1);
		$recordPerPage = $this->request->get('recordperpage',12);
		$mediaLibraryData = $this->imageLibraryManager->getMediaLibraryRecordsWithPagination(null,$page,$recordPerPage);
		
		if(isset($mediaLibraryData['media_library_records'])){
			$newData['items'] = $mediaLibraryData['media_library_records']->getItems();
			$newData['pagination'] = $mediaLibraryData['media_library_records']->getPaginationData();
			
			if(count($newData['items'])>0){
				$itemAry = array();
				foreach ($newData['items'] as $items){
					$itemAry[] = array('id'=>$items->getId(),
							'name'=>$items->getName(),
							'image_url'=>$this->mediaFileURL.'/'.$items->getName(),
							'type'=>$items->getType(),
							'image_name'=>$items->getImageName(),
							'customer_name'=>$items->getCustomerName());
				}
				$newData['items'] = $itemAry;
				return array('status' => 'success', 'status_code' => 1, 'data' => $newData);
			}
		}
		return array('status' => 'error', 'status_code' => 0, 'message' => 'no record found');
	}

	/**
	 * @author Employee Id: 410175
	 * Description : upload image to media library and add image name and cutomer name to image
	 * @param 1 : No paramater
	 * @return type : Ajax response
	 * @throws Exception: Null
	 *
	 * @Route("/{_locale}/upload-artwork-detail", name="office_brain_requestquotebundle_requestquote_uploadartworkdetail_api")
	 * 
	 * @ApiDoc(
     *      resource=true,
     *      section="Media Library|Artwork",
     *      description="To upload image/file to media library",
     *      requirements={     
     *      	{"name"="_locale", "dataType"="string", "default"="en_us"},
     *      	{"name"="access_token", "dataType"="string", "required"=true, "description"="valid access token"},
     *      	{"name"="uploadNewImage", "dataType"="string", "description"="valid image|file to uplaod "},
     *      },
     *      input = {
	 *      	"class" = "\OfficeBrain\Bundle\RequestQuoteBundle\Form\ApiUploadArtWorkDetailType",
	 *      },      
     *      statusCodes={
     *              1="Returned when success",
     *              403="Returned when the user is not authorized to see this link",
     *              0="Returned when form validation is failed",
     *      }
     * )
	 * 
	 * @Template("")
	 *  @Method({"POST"})
	 * /
	public function uploadArtWorkDetailAction()
	{
		if (false === $this->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
			throw new AccessDeniedException();
		} 
		
		$this->initAction();
		
		$addtoDb = 'no';
		$this->filename = $this->fileType = null;

		$this->form = $this->createForm(new UploadArtWorkDetailType($this->filename,$this->fileType), null, array('csrf_protection' => false));
		$this->form->handleRequest($this->request);
		
		if ($this->form->isValid() && (isset($_FILES['uploadNewImage']))) {
			$file = $_FILES['uploadNewImage'];
			$this->filename=$this->imageLibraryManager->uploadMediaFileToFolder($_FILES,$this->mediaFilePath,$addtoDb);
			$this->filename = $this->filename[0];
			$this->fileType=$this->imageLibraryManager->checkUploadedMediaType($file);
			
			$this->imageName = $this->form['image_name']->getData();
			$this->customerName = $this->form['customer_name']->getData();
		
			$uploadedMediaInfo = array('name' => $this->filename, 'type' => $this->fileType, 'image_name' => $this->imageName, 'customer_name' => $this->customerName);
			$this->imageLibraryManager->setMedia($uploadedMediaInfo); // add file to image library (add to database)
			//$response = $this->imageLibraryManager->copyMedia($this->artworkTempFilePath, $this->mediaFilePath, $this->filename,$this->filename); // copy image to media library
			//$this->name= $this->imageLibraryManager->copyMedia($this->artworkTempFilePath, $this->artworkFilePath ,$this->filename,$this->filename); // copy image to artwork library
			//$this->imageLibraryManager->deleteFile($this->artworkTempFilePath,$this->filename); // delete file from tmp folder
			$fileDetail = $this->mediaFileURL.'/'.$this->filename; 
			return array('status' => 'success', 'status_code' => 1, 'data' => array('fileDetail'=>$fileDetail ));
		}
		
		$errors = $this->commonLibraryManager->prepareFormJsonError($this->form);
		if(isset($errors['form_errors'])){
			$error = $errors['form_errors'];			
		}else{
			$error['other_error'] = 'Please check all the field';
		}
		if( (!isset($_FILES['uploadNewImage'])) ) {
			$error['image'] = 'Please upload image';
		}	
		return array('status' => 'error', 'status_code' => 0, 'message' => $error);
	}
	
	/**
	 * @author Employee Id: 410175
	 * Description : Use to dalete a record
	 * @param 1 : No paramater
	 * @return type : Form view and data.
	 * @throws Exception: Null
	 *
	 * @Route("/{_locale}/delete-request-quote", name="office_brain_requestquotebundle_requestquote_deleterequestquote_api")
	 * 
	 * @ApiDoc(
     *      resource=true,
     *      section="Request Quote",
     *      description="to delete request quote",
     *      requirements={     
     *      	{"name"="_locale", "dataType"="string", "default"="en_us"},
     *      	{"name"="access_token", "dataType"="string", "required"=true, "description"="valid access token"},
     *      	{"name"="product_id", "dataType"="integer", "description"="valid product ID"},
     *      	{"name"="culture_product_id", "dataType"="integer", "description"="valid culture Product ID"},
     *      },      
     *      statusCodes={
     *              1="Returned when success",
     *              403="Returned when the user is not authorized to see this link",
     *              0="Returned when form validation is failed",
     *      }
     * )
	 * 
	 * @Template("")
	 * @Method({"GET"})
	 * /
	public function deleteRequestQuoteAction()
	{
		if (false === $this->get('security.context')->isGranted('IS_AUTHENTICATED_FULLY')) {
			throw new AccessDeniedException();
		}
		
		$this->initAction();
		$this->responseArray = null;
		$deleteStatus = $this->requestQuoteManager->deletePreRequestQuote();
		
		switch ($deleteStatus) {			
			case 'SUCCESS':
				$this->responseArray['status'] = 'success';
				$this->responseArray['status_code'] = 1;
				$this->responseArray['data']['total_record'] = $this->requestQuoteManager->getTotalRequestQuoteCount();
				return $this->responseArray;
				break;
		}
		return array('status' => 'error', 'status_code' => 0, 'message' => $this->get('translator')->trans('request_quote.no_record'));
	}
	
	/**
	 * @author Employee Id: 410175
	 * Description : Use to get Reuqest Quote Configuration Rule.
	 *
	 * @Route("/{_locale}/get-request-quote-configuration-rule",name="office_brain_requestquotebundle_requestquote_getrequestquoteconfigurationrule_api")
	 *
	 * @ApiDoc(
	 *      resource=true,
	 *      section="Request Quote",
	 *      description="To get Reuqest Quote Configuration Rule.",
	 *      requirements={
	 *      	{"name"="_locale", "dataType"="string", "default"="en_us"},
	 *      	{"name"="access_token", "dataType"="string", "required"=false, "description"="valid access token"},
	 *      },
	 *      statusCodes={
	 *              1="Returned when success",
	 *              403="Returned when the user is not authorized to see this link",
	 *              0="Returned when form validation is failed",
	 *      }
	 * )
	 *
	 * @Template()
	 * @Method({"POST"})
	 * /
	public function getRequestQuoteConfigurationRuleAction()
	{
		$this->initAction();
		
		$data = $this->productDetailconfigurationRule;
	
		if($this->responseFormat == "json"){
			return array('status'=>'success','status_code'=>1,'data' => $data);
		}
		return $data;
	}
	
	private function copyMediaImageToArtwork ($imageWithUrl, $imageName){
		if(($this->artworkFileURL.'/'.$imageName) == $imageWithUrl){
			return $imageWithUrl;
		}
		
		$imageUpload = $this->imageLibraryManager->copyMedia($this->mediaFilePath, $this->artworkFilePath , $imageName, $imageName);
		
		if ( $imageUpload != '' ) {
			return $this->artworkFileURL.'/'.$imageName;
		}
		return null;
	}*/
}