<?php

declare(strict_types=1);

namespace Plugin\cin_portlets_5\Portlets\PhotoVideoSlider;

use Cin\Portlets5\Plugin;
use Cin\Portlets5\PortletTrait;
use JTL\OPC\InputType;
use JTL\OPC\Portlet;
use JTL\OPC\PortletInstance;

// require \dirname(__DIR__, 2).'/src/warmup.php';

final class PhotoVideoSlider extends Portlet
{
  use PortletTrait;

  private $fontAwesome = 'fas fa-photo-video';

  public function getPropertyDesc(): array
  {
    return [

      'Breite' => [
        'type'  => InputType::NUMBER,
        'label' => __('Breite(px)'),
        'width' => 30

      ],
      'Höhe' => [
        'type'  => InputType::NUMBER,
        'label' => __('Höhe(px)'),
        'width' => 30

      ],

      'URL' => [
        'type'    => InputType::TEXT,
        'label'   => __('Video-ID/ Video-URL'),
        'width'   => 100,
        'default' => false
      ],
      'slider-animation-speed' => [
        'label'   => __('SliderGeschwindigkeit'),
        'type'    => InputType::NUMBER,
        'default' => 7000,
        'width'   => 34,
      ],
      'slider-animation-pause' => [
        'label'   => __('Pause'),
        'type'    => InputType::NUMBER,
        'default' => 6000,
        'width'   => 34,
      ],
      'slider-start' => [
        'label'   => __('autoStart'),
        'type'    => InputType::RADIO,
        'options' => [
          'true'  => __('yes'),
          'false' => __('no'),
        ],
        'default' => 'true',
        'inline'  => true,
        'width'   => 25,
      ],
      'slider-navigation' => [
        'label'   => __('PunktNavigation'),
        'type'    => InputType::RADIO,
        'options' => [
          'true'  => __('yes'),
          'false' => __('no'),
        ],
        'default' => 'false',
        'width'   => 25,
      ],
      'slider-direction-navigation' => [
        'label'   => __('PfeilNavigation'),
        'type'    => InputType::RADIO,
        'options' => [
          'true'  => __('yes'),
          'false' => __('no'),
        ],
        'default' => 'false',
        'width'   => 25
      ],

      // 'Video-Start' => [
      //   'type'    => InputType::NUMBER,
      //   'label'   => __('Start bei Sekunde'),
      //   'width'   => 50,
      //   'default' => false
      // ],
      // 'Video-End' => [
      //   'type'    => InputType::NUMBER,
      //   'label'   => __('Ende bei Sekunde'),
      //   'width'   => 50,
      //   'default' => false
      // ],

    ];
  }

  public function getConfigPanelHtml(PortletInstance $instance): string
  {
    return parent::getConfigPanelHtml($instance)
      .$this->extendConfigDialog($instance);
  }

  public function getPluginDirectory(): string
  {
    $P = new Plugin();

    return $P->getJTlPlugin()->getPaths()->getPortletsUrl();
  }

  public function getPropertyTabs(): array
  {
    return [
      __('Styles') => 'styles',
    ];
  }
}
