<?php

namespace EssentialElements;

use function Breakdance\Elements\c;
use function Breakdance\Elements\PresetSections\getPresetSection;


\Breakdance\ElementStudio\registerElementForEditing(
    "EssentialElements\\ImageHoverCard",
    \Breakdance\Util\getdirectoryPathRelativeToPluginFolder(__DIR__)
);

class ImageHoverCard extends \Breakdance\Elements\Element
{
    static function uiIcon()
    {
        return 'ImagePolaroidIcon';
    }

    static function tag()
    {
        return 'div';
    }

    static function tagOptions()
    {
        return [];
    }

    static function tagControlPath()
    {
        return false;
    }

    static function name()
    {
        return 'Image Hover Card';
    }

    static function className()
    {
        return 'bde-image-hover-card';
    }

    static function category()
    {
        return 'blocks';
    }

    static function badge()
    {
        return false;
    }

    static function slug()
    {
        return get_class();
    }

    static function template()
    {
        return file_get_contents(__DIR__ . '/html.twig');
    }

    static function defaultCss()
    {
        return file_get_contents(__DIR__ . '/default.css');
    }

    static function defaultProperties()
    {
        return ['content' => ['content' => ['caption_tag' => 'h3', 'caption_position' => 'c4-layout-center-right', 'border_effect' => 'c4-border-ccc-1', 'image_effect' => 'c4-image-zoom-out', 'image' => '', 'text_effect' => 'c4-reveal-right', 'single_caption' => 'My caption', 'url' => null], 'captions' => ['caption' => 'null', 'captions' => ['0' => ['text' => 'use breakdance', 'effect' => 'c4-reveal-right', 'delay' => 'c4-delay-200'], '1' => ['effect' => 'c4-reveal-right', 'delay' => 'c4-delay-400', 'text' => 'be happy']], 'position' => 'c4-layout-center-right'], 'multiple_captions' => ['captions' => ['0' => ['text' => 'Easily add beautiful', 'delay' => 'c4-delay-200', 'effect' => null], '1' => ['text' => 'image hover effects', 'delay' => 'c4-delay-400', 'effect' => null]]], 'link' => null, 'image' => null], 'design' => ['settings' => ['primary_color' => '#D82F2FFF', 'secondary_color' => '#080808FF', 'gradient_overlay' => 'c4-gradient-right', 'transition_duration' => 0.3, 'overlay_opacity' => 0.4, 'border_color' => '#FFFFFFFF', 'border_width' => ['number' => 4, 'unit' => 'px', 'style' => '4px'], 'width' => ['breakpoint_base' => ['number' => 100, 'unit' => '%', 'style' => '100%']], 'max_width' => ['breakpoint_base' => ['number' => -1, 'unit' => 'px', 'style' => '-1px']], 'caption_typography' => ['line_height' => ['breakpoint_base' => ['number' => 1.3, 'unit' => 'em', 'style' => '1.3em']], 'font_size' => ['breakpoint_base' => ['number' => 20, 'unit' => 'px', 'style' => '20px']], 'color' => ['breakpoint_base' => '#FFFFFFFF'], 'font_weight' => ['breakpoint_base' => '500']]], 'size' => ['width' => ['breakpoint_base' => ['number' => 500, 'unit' => 'px', 'style' => '500px']], 'max_width' => ['breakpoint_base' => ['number' => 500, 'unit' => 'px', 'style' => '500px']]], 'overlay' => ['primary_color' => '#DE2626FF', 'secondary_color' => '#121111FF', 'gradient_overlay' => 'c4-gradient-top-right', 'overlay_opacity' => 0.4, 'color_1' => '#060110FF', 'color_2' => '#5D0E9EFF', 'direction' => 'c4-gradient-right', 'opacity' => 0.3, 'overlay_color' => ['points' => ['0' => ['left' => 1.5384615384615385, 'red' => 15, 'green' => 165, 'blue' => 172, 'alpha' => 1], '1' => ['left' => 98.46153846153847, 'red' => 95, 'green' => 72, 'blue' => 162, 'alpha' => 1]], 'type' => 'linear', 'degree' => 0, 'svgValue' => '<linearGradient x1="0.5" y1="1" x2="0.5" y2="0" id="%%GRADIENTID%%"><stop stop-opacity="1" stop-color="#0fa5ac" offset="0.015384615384615385"></stop><stop stop-opacity="1" stop-color="#5f48a2" offset="0.9846153846153847"></stop></linearGradient>', 'value' => 'linear-gradient(0deg,rgba(15, 165, 172, 1) 1.5384615384615385%,rgba(95, 72, 162, 1) 98.46153846153847%)']], 'spacing_margin_y' => null, 'effects' => ['border_width' => ['number' => 2, 'unit' => 'px', 'style' => '2px'], 'border_color' => '#F1F1F1FF', 'transition_duration' => ['number' => 600, 'unit' => 'ms', 'style' => '600ms'], 'border_effect' => 'c4-border-bottom', 'image_effect' => 'c4-image-pan-down'], 'typography' => ['custom' => ['breakpoint_base' => ['fontSize' => ['number' => 24, 'unit' => 'px', 'style' => '24px'], 'fontWeight' => '700', 'textTransform' => 'none', 'fontStyle' => 'normal', 'letterSpacing' => ['unit' => 'custom', 'number' => 'normal', 'style' => 'normal'], 'textDirection' => 'ltr', 'lineHeight' => ['unit' => 'custom', 'number' => 'normal', 'style' => 'normal'], 'textDecoration' => 'none']], 'color' => ['breakpoint_base' => '#FDFDFDFF']]]];
    }

    static function defaultChildren()
    {
        return false;
    }

    static function cssTemplate()
    {
        $template = file_get_contents(__DIR__ . '/css.twig');
        return $template;
    }

    static function designControls()
    {
        return [c(
        "size",
        "Size",
        [c(
        "width",
        "Width",
        [],
        ['type' => 'unit', 'layout' => 'inline'],
        true,
        false,
        [],
      )],
        ['type' => 'section'],
        false,
        false,
        [],
      ), c(
        "overlay",
        "Overlay",
        [c(
        "overlay_color",
        "Overlay Color",
        [],
        ['type' => 'color', 'layout' => 'inline', 'colorOptions' => ['type' => 'solidAndGradient']],
        false,
        false,
        [],
      ), c(
        "opacity",
        "Opacity",
        [],
        ['type' => 'number', 'layout' => 'inline', 'rangeOptions' => ['step' => 0.1, 'min' => 0, 'max' => 1]],
        false,
        false,
        [],
      )],
        ['type' => 'section'],
        false,
        false,
        [],
      ), c(
        "effects",
        "Effects",
        [c(
        "image_effect",
        "Image Effect",
        [],
        ['type' => 'dropdown', 'layout' => 'inline', 'items' => ['0' => ['text' => 'Zoom In', 'label' => 'Label', 'value' => 'c4-image-zoom-in'], '1' => ['text' => 'Zoom Out', 'value' => 'c4-image-zoom-out'], '2' => ['text' => 'Pan Up', 'value' => 'c4-image-pan-up'], '3' => ['text' => 'Pan Down', 'value' => 'c4-image-pan-down'], '4' => ['text' => 'Pan Left', 'value' => 'c4-image-pan-left'], '5' => ['text' => 'Pan Right', 'value' => 'c4-image-pan-right'], '6' => ['text' => 'Rotate Left', 'value' => 'c4-image-rotate-left'], '7' => ['text' => 'Rotate Right', 'value' => 'c4-image-rotate-right'], '8' => ['text' => 'Blur', 'value' => 'c4-image-blur']]],
        false,
        false,
        [],
      ), c(
        "border_effect",
        "Border Effect",
        [],
        ['type' => 'dropdown', 'layout' => 'inline', 'items' => ['0' => ['text' => 'Center', 'label' => 'Label', 'value' => 'c4-border-center'], '1' => ['value' => 'c4-border-vert', 'text' => 'Vertical'], '2' => ['text' => 'Horizontal', 'value' => 'c4-border-horiz'], '3' => ['text' => 'Top', 'value' => 'c4-border-top'], '4' => ['text' => 'Bottom', 'value' => 'c4-border-bottom'], '5' => ['text' => 'Left', 'value' => 'c4-border-left'], '6' => ['text' => 'Right', 'value' => 'c4-border-right'], '7' => ['text' => 'Top Left', 'value' => 'c4-border-top-left'], '8' => ['text' => 'Top Right', 'value' => 'c4-border-top-right'], '9' => ['text' => 'Bottom Left', 'value' => 'c4-border-bottom-left'], '10' => ['text' => 'Bottom Right', 'value' => 'c4-border-bottom-right'], '11' => ['text' => 'Corners', 'value' => 'c4-border-corners-1'], '12' => ['text' => 'Corners 2', 'value' => 'c4-border-corners-2'], '13' => ['text' => 'CC 1', 'value' => 'c4-border-cc-1'], '14' => ['text' => 'CC 2', 'value' => 'c4-border-cc-2'], '15' => ['text' => 'CC 3', 'value' => 'c4-border-cc-3'], '16' => ['text' => 'CCC 1', 'value' => 'c4-border-ccc-1'], '17' => ['text' => 'CCC 2', 'value' => 'c4-border-ccc-2'], '18' => ['text' => 'CCC 3', 'value' => 'c4-border-ccc-3']]],
        false,
        false,
        [],
      ), c(
        "border_width",
        "Border Width",
        [],
        ['type' => 'unit', 'layout' => 'inline'],
        false,
        false,
        [],
      ), c(
        "border_color",
        "Border Color",
        [],
        ['type' => 'color', 'layout' => 'inline'],
        false,
        false,
        [],
      ), c(
        "transition_duration",
        "Transition Duration",
        [],
        ['type' => 'unit', 'layout' => 'inline', 'rangeOptions' => ['step' => 10, 'min' => 0, 'max' => 1000], 'unitOptions' => ['types' => ['0' => 'ms'], 'defaultType' => 'ms']],
        false,
        false,
        [],
      )],
        ['type' => 'section'],
        false,
        false,
        [],
      ), getPresetSection(
      "EssentialElements\\typography_with_effects",
      "Typography",
      "typography",
       ['type' => 'popout']
     ), getPresetSection(
      "EssentialElements\\spacing_margin_y",
      "Spacing",
      "spacing",
       ['type' => 'popout']
     )];
    }

    static function contentControls()
    {
        return [c(
        "image",
        "Image",
        [c(
        "image",
        "Image",
        [],
        ['type' => 'wpmedia', 'layout' => 'vertical'],
        false,
        false,
        [],
      ), c(
        "size",
        "Size",
        [],
        ['type' => 'media_size_dropdown', 'layout' => 'vertical', 'mediaSizeOptions' => ['imagePropertyPath' => 'content.image.image'], 'condition' => ['path' => 'content.image.image', 'operand' => 'is set', 'value' => '']],
        false,
        false,
        [],
      ), c(
        "alt",
        "Alt",
        [],
        ['type' => 'text', 'layout' => 'vertical', 'condition' => ['path' => 'content.image.image', 'operand' => 'is set', 'value' => '']],
        false,
        false,
        [],
      ), c(
        "lazy_load",
        "Lazy Load",
        [],
        ['type' => 'toggle', 'layout' => 'inline', 'condition' => ['path' => 'content.image.image', 'operand' => 'is set', 'value' => '']],
        false,
        false,
        [],
      )],
        ['type' => 'section', 'layout' => 'vertical'],
        false,
        false,
        [],
      ), c(
        "captions",
        "Captions",
        [c(
        "captions",
        "Captions",
        [c(
        "text",
        "Text",
        [],
        ['type' => 'text', 'layout' => 'vertical'],
        false,
        false,
        [],
      ), c(
        "effect",
        "Effect",
        [],
        ['type' => 'dropdown', 'layout' => 'inline', 'items' => ['0' => ['text' => 'reveal-up', 'label' => 'Label', 'value' => 'c4-reveal-up'], '1' => ['text' => 'reveal-down', 'value' => 'c4-reveal-down'], '2' => ['text' => 'reveal-left', 'value' => 'c4-reveal-left'], '3' => ['text' => 'reveal-right', 'value' => 'c4-reveal-right'], '4' => ['text' => 'fade-up', 'value' => 'c4-fade-up'], '5' => ['text' => 'fade-down', 'value' => 'c4-fade-down'], '6' => ['text' => 'fade-left', 'value' => 'c4-fade-left'], '7' => ['text' => 'fade-right', 'value' => 'c4-fade-right'], '8' => ['text' => 'rotate-up-right', 'value' => 'c4-rotate-up-right'], '9' => ['text' => 'rotate-up-left', 'value' => 'c4-rotate-up-left'], '10' => ['text' => 'rotate-down-right', 'value' => 'c4-rotate-down-right'], '11' => ['text' => 'rotate-down-left', 'value' => 'c4-rotate-down-left']]],
        false,
        false,
        [],
      ), c(
        "delay",
        "Delay",
        [],
        ['type' => 'dropdown', 'layout' => 'inline', 'items' => ['0' => ['text' => '100ms', 'label' => 'Label', 'value' => 'c4-delay-100'], '1' => ['text' => '200ms', 'value' => 'c4-delay-200'], '2' => ['text' => '300ms', 'value' => 'c4-delay-300'], '3' => ['text' => '400ms', 'value' => 'c4-delay-400'], '4' => ['text' => '500ms', 'value' => 'c4-delay-500'], '5' => ['text' => '600ms', 'value' => 'c4-delay-600'], '6' => ['text' => '700ms', 'value' => 'c4-delay-700'], '7' => ['text' => '800ms', 'value' => 'c4-delay-800'], '8' => ['text' => '900ms', 'value' => 'c4-delay-900'], '9' => ['text' => '1s', 'value' => 'c4-delay-1000']]],
        false,
        false,
        [],
      )],
        ['type' => 'repeater', 'layout' => 'vertical', 'repeaterOptions' => ['titleTemplate' => '{text}', 'defaultTitle' => 'Caption', 'buttonName' => 'Add Caption']],
        false,
        false,
        [],
      ), c(
        "position",
        "Position",
        [],
        ['type' => 'dropdown', 'layout' => 'inline', 'items' => ['0' => ['text' => 'layout-top-left', 'label' => 'Label', 'value' => 'c4-layout-top-left'], '1' => ['text' => 'layout-top-center', 'value' => 'c4-layout-top-center'], '2' => ['text' => 'layout-top-right', 'value' => 'c4-layout-top-right'], '3' => ['text' => 'layout-center-left', 'value' => 'c4-layout-center-left'], '4' => ['text' => 'layout-center-right', 'value' => 'c4-layout-center-right'], '5' => ['text' => 'layout-bottom-left', 'value' => 'c4-layout-bottom-left'], '6' => ['text' => 'layout-bottom-center', 'value' => 'c4-layout-bottom-center'], '7' => ['text' => 'layout-bottom-right', 'value' => 'c4-layout-bottom-right']]],
        false,
        false,
        [],
      ), c(
        "tag",
        "Tag",
        [],
        ['type' => 'dropdown', 'layout' => 'inline', 'items' => ['0' => ['text' => 'h1', 'label' => 'Label', 'value' => 'h1'], '1' => ['text' => 'h2', 'value' => 'h2'], '2' => ['text' => 'h3', 'value' => 'h3'], '3' => ['text' => 'h4', 'value' => 'h4'], '4' => ['text' => 'h5', 'value' => 'h5'], '5' => ['text' => 'h6', 'value' => 'h6'], '6' => ['text' => 'Div', 'value' => 'div']]],
        false,
        false,
        [],
      )],
        ['type' => 'section', 'layout' => 'vertical'],
        false,
        false,
        [],
      ), c(
        "link",
        "Link",
        [c(
        "link",
        "Link",
        [],
        ['type' => 'link', 'layout' => 'vertical'],
        false,
        false,
        [],
      )],
        ['type' => 'section', 'layout' => 'vertical'],
        false,
        false,
        [],
      )];
    }

    static function settingsControls()
    {
        return [];
    }

    static function dependencies()
    {
        return ['0' =>  ['styles' => ['%%BREAKDANCE_ELEMENTS_PLUGIN_URL%%dependencies-files/izmir@1/izmir.min.css'],],];
    }

    static function settings()
    {
        return ['proOnly' => true];
    }

    static function addPanelRules()
    {
        return false;
    }

    static public function actions()
    {
        return false;
    }

    static function nestingRule()
    {
        return ["type" => "final",   ];
    }

    static function spacingBars()
    {
        return ['0' => ['location' => 'outside-top', 'cssProperty' => 'margin-top', 'affectedPropertyPath' => 'design.spacing.margin_top.%%BREAKPOINT%%'], '1' => ['location' => 'outside-bottom', 'cssProperty' => 'margin-bottom', 'affectedPropertyPath' => 'design.spacing.margin_bottom.%%BREAKPOINT%%']];
    }

    static function attributes()
    {
        return false;
    }

    static function experimental()
    {
        return false;
    }

    static function order()
    {
        return 3800;
    }

    static function dynamicPropertyPaths()
    {
        return ['0' => ['accepts' => 'image_url', 'path' => 'content.image.image'], '1' => ['accepts' => 'string', 'path' => 'content.captions.captions[].text'], '2' => ['accepts' => 'url', 'path' => 'content.link.link.url']];
    }

    static function additionalClasses()
    {
        return false;
    }

    static function projectManagement()
    {
        return ['looksGood' => 'yes', 'optionsGood' => 'yes', 'optionsWork' => 'no', 'dynamicBehaviorWorks' => 'yes', 'notes' => 'https://github.com/soflyy/breakdance-elements/issues/583'];
    }

    static function propertyPathsToWhitelistInFlatProps()
    {
        return false;
    }

    static function propertyPathsToSsrElementWhenValueChanges()
    {
        return false;
    }
}
