<?php

namespace OfficeBrain\Bundle\SubShopBundle\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\Response;

/**
 * @author OfficeBrain 4494 <info@officebrain.com>
 *
 * Description : Sub shop Theme class.
 **/
class SubShopThemeController extends Controller
{
    private $responseArray;

    private $subShopManager;

    private $subshopThemeManager;

    public function __construct()
    {
        $this->responseArray = array();
        $this->subShopManager = null;
        $this->subshopThemeManager = null;
    }

    public function __destruct()
    {
        unset($this->responseArray);
        unset($this->subShopManager);
        unset($this->subshopThemeManager);
    }

    public function initAction()
    {
        $this->subShopManager = $this->get('office_brain_subshop_manager');
        $this->subshopThemeManager = $this->get('office_brain_subshop_theme_manager');
        $this->responseArray = array();
    }

    /**
     * @author Employee Id: 4494
     * Description : Get subshop theme custom css
     *
     * @param 1 : No paramater
     *
     * @return type : Css data.
     *
     * @throws Exception: Null
     *
     * @Route("/{_locale}/assets/css/custom.css", name="office_brain_subshopbundle_subshoptheme_subshopthemedesigncustomcss")
     *
     * @Method("GET")
     *
     * @Template()
     */
    public function subshopThemeDesignCustomCssAction()
    {
        $this->initAction();

        /*$this->responseArray['subshop'] = $this->subShopManager->searchByParentIdSubShop();
        $this->responseArray['themeDesign'] = $this->subshopThemeManager->getSubShopThemeDesign($this->responseArray['subshop']->getId());
        $this->responseArray['themeDesign'] = json_decode($this->responseArray['themeDesign']->getCustomDesign(), 'Array');
        */

        $response = new Response();
        $response->headers->set('Content-Type', 'text/css');

        return $this->render(
                'OfficeBrainSubShopBundle:SubShopThemeAdmin:theme_design_css.html.twig',
                $this->responseArray,
                $response
        );
    }
}
