<?php 
/** 
 * Copyright Blackbit digital Commerce GmbH <info@blackbit.de> 
 * 
 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. 
 * 
 * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 
 * 
 * You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 
 */ 
 
namespace Blackbit\DataDirectorBundle; 
 
use Blackbit\DataDirectorBundle\lib\Pim\Logger\Logger; 
use Blackbit\DataDirectorBundle\Tools\Installer; 
use Pimcore\Db; 
use Pimcore\Extension\Bundle\AbstractPimcoreBundle; 
use Pimcore\Extension\Bundle\Traits\PackageVersionTrait; 
 
class BlackbitDataDirectorBundle extends AbstractPimcoreBundle 
{ 
    use PackageVersionTrait { 
        getVersion as protected getComposerVersion; 
    } 
 
    public function getInstaller() 
    { 
        return $this->container->get(Installer::class); 
    } 
 
    public function getJsPaths() 
    { 
        $return = [ 
            '/bundles/blackbitdatadirector/js/fieldType/calculateValueDataQuerySelector/data.js', 
            '/bundles/blackbitdatadirector/js/fieldType/calculateValueDataQuerySelector/tag.js', 
            '/bundles/blackbitdatadirector/js/fieldType/inputWithPlaceholders/data.js', 
            '/bundles/blackbitdatadirector/js/fieldType/inputWithPlaceholders/tag.js', 
            '/bundles/blackbitdatadirector/js/fieldType/textareaWithPlaceholders/data.js', 
            '/bundles/blackbitdatadirector/js/fieldType/textareaWithPlaceholders/tag.js', 
            '/bundles/blackbitdatadirector/js/ImportConfig.js', 
            '/bundles/blackbitdatadirector/js/plugin.js', 
            '/bundles/blackbitdatadirector/js/components/DataportPanel.js', 
            '/bundles/blackbitdatadirector/js/components/DataportPreview.js', 
            '/bundles/blackbitdatadirector/js/components/ManualImport.js', 
            '/bundles/blackbitdatadirector/js/components/MappingPanel.js', 
            '/bundles/blackbitdatadirector/js/gridOperatorDataQuerySelector.js', 
            '/bundles/blackbitdatadirector/js/gridExport.js', 
            '/bundles/blackbitdatadirector/js/gridExportCsv.js', 
            '/bundles/blackbitdatadirector/js/gridExportXml.js', 
            '/bundles/blackbitdatadirector/js/gridExportJson.js', 
            '/bundles/blackbitdatadirector/js/reportAdapter.js', 
            '/bundles/blackbitdatadirector/js/components/VersionPanel.js', 
        ]; 
 
        if(!file_exists(PIMCORE_WEB_ROOT.'/bundles/pimcoreadmin/js/lib/ace')) { 
            $return[] = '/bundles/blackbitdatadirector/vendor/ace/ace.js'; 
        } 
        $return[] = '/bundles/blackbitdatadirector/vendor/ace/ext-language_tools.js'; 
 
        return $return; 
    } 
 
    public function getCssPaths() 
    { 
        return [ 
            '/bundles/blackbitdatadirector/css/pim.css', 
            '/bundles/blackbitdatadirector/vendor/php-diff/diff-table.css' 
        ]; 
    } 
 
    /** 
     * Returns the composer package name used to resolve the version 
     * 
     * @return string 
     */ 
    protected function getComposerPackageName(): string 
    { 
        return 'blackbit/data-director'; 
    } 
 
    public function getVersion() 
    { 
        try { 
            return $this->getComposerVersion(); 
        } catch (\Exception $e) { 
            return 'unknown'; 
        } 
    } 
}