<?php
global $homeHeroPatternParams;

$sellingPoints = '';
if ($homeHeroPatternParams['selling_points'] && is_countable($homeHeroPatternParams['selling_points'])) {
  $count = 0;
  foreach ($homeHeroPatternParams['selling_points'] as $sellingPoint) {
    $sellingPoints .= '"selling_points_' . $count . '_item":"' . $sellingPoint['text'] . '","_selling_points_' . $count . '_item":"field_65999eccb71e6",';
    $count++;
  }
  $sellingPoints .= '"selling_points":' . $count . ',"_selling_points":"field_65999ebab71e5"';
}

$heroContent = '';
if ($homeHeroPatternParams['theme'] == 'triumph') {
  $heroContent .= '<!-- wp:acf/home-hero {"name":"acf/home-hero","data":{"theme":"triumph","_theme":"field_677856271d740","image":' . $homeHeroPatternParams['image_id'] . ',"_image":"field_677993ccbf6d5","background_color":"","_background_color":"field_6598eb5413ecb"},"mode":"preview","metadata":{"categories":["miocommerce-pattern"],"patternName":"olympus/home-banner-triumph","name":"Home Banner (Triumph)"}} -->
<!-- wp:spacer {"height":"50px"} -->
<div style="height:50px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:group {"className":"orphic-motion-animation","style":{"spacing":{"blockGap":"var:preset|spacing|40","padding":{"right":"0","left":"0"}}},"layout":{"type":"constrained","justifyContent":"left"},"hasAnimation":true,"animationType":"fadeIn","animationDuration":300,"animationDelay":200,"triggerPoint":10,"scrollBehavior":"playOnView"} -->
<div class="wp-block-group orphic-motion-animation orphic-motion-animation" style="padding-right:0;padding-left:0" data-animation-type="fadeIn" data-animation-duration="300" data-animation-delay="200" data-animation-trigger="10" data-scroll-behavior="playOnView"><!-- wp:heading {"textAlign":"left","level":1,"style":{"elements":{"link":{"color":{"text":"var:preset|color|base"}}}},"textColor":"base"} -->
<h1 class="wp-block-heading has-text-align-left has-base-color has-text-color has-link-color">' . $homeHeroPatternParams['main_title'] . '</h1>
<!-- /wp:heading -->

<!-- wp:heading {"textAlign":"left","style":{"elements":{"link":{"color":{"text":"var:preset|color|base"}}}},"textColor":"base"} -->
<h2 class="wp-block-heading has-text-align-left has-base-color has-text-color has-link-color">' . $homeHeroPatternParams['subtitle'] . '</h2>
<!-- /wp:heading -->';

  if ($homeHeroPatternParams['buttons'] && count($homeHeroPatternParams['buttons'])) {
    $heroContent .= '<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"left"}} -->
<div class="wp-block-buttons">';
    foreach ($homeHeroPatternParams['buttons'] as $button) {
      $heroContent .= '<!-- wp:button {"style":{"typography":{"lineHeight":"2.1"}}} -->
    <div class="wp-block-button" style="line-height:2.1"><a href="' . $button['url'] . '" class="wp-block-button__link wp-element-button">' . $button['title'] . '</a></div>
    <!-- /wp:button -->
    ';
    }
    $heroContent .= '</div>
  <!-- /wp:buttons -->';
  }

  $heroContent .=  '</div>
<!-- /wp:group -->

<!-- wp:spacer {"height":"var:preset|spacing|50"} -->
<div style="height:var(--wp--preset--spacing--50)" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->';

  if ($homeHeroPatternParams['variation'] == 'premium' && $homeHeroPatternParams['price_card']) {
    $heroContent .=  '<!-- wp:acf/price-card {"name":"acf/price-card","data":{"card_title":"' . $homeHeroPatternParams['price_card']['priceCardTitle'] . '","_card_title":"field_659e0a8f99b7e","has_live_pricing":"1","_has_live_pricing":"field_659e0cb6e1f20","theme":"accelerator","_theme":"field_6769b2d41153d"},"mode":"preview"} -->
  <!-- wp:paragraph {"align":"center"} -->
  <p class="has-text-align-center">' . $homeHeroPatternParams['price_card']['priceCardDescription'] . '</p>
  <!-- /wp:paragraph -->
  
  <!-- wp:buttons -->
  <div class="wp-block-buttons"><!-- wp:button {"width":100,"className":"is-style-fill"} -->
  <div class="wp-block-button has-custom-width wp-block-button__width-100 is-style-fill"><a href="' . $homeHeroPatternParams['price_card']['selectedService'] . '" class="wp-block-button__link wp-element-button">' . $homeHeroPatternParams['price_card']['priceCardLinkText'] . '</a></div>
  <!-- /wp:button --></div>
  <!-- /wp:buttons -->
  <!-- /wp:acf/price-card -->';
  }


  $heroContent .=  '<!-- wp:spacer {"height":"20px"} -->
<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- /wp:acf/home-hero -->';
} elseif ($homeHeroPatternParams['theme'] == 'accelerator') {
  $heroContent .= '<!-- wp:acf/home-hero {"name":"acf/home-hero","data":{"theme":"accelerator","_theme":"field_677856271d740","image":' . $homeHeroPatternParams['image_id'] . ',"_image":"field_677993ccbf6d5","overlay_opacity":"1","_overlay_opacity":"field_6599a19918f5d","has_overflow":"1","_has_overflow":"field_659e035304d34"},"mode":"preview","metadata":{"categories":["miocommerce-pattern"],"patternName":"olympus/home-banner-accelerator","name":"Home Banner (Accelerator)"}} -->
<!-- wp:spacer {"height":"90px"} -->
<div style="height:90px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|40"}},"layout":{"type":"constrained"},"hasAnimation":true,"animationType":"fadeIn","animationDistance":50,"animationDuration":300,"animationDelay":200,"triggerPoint":30,"scrollBehavior":"playOnView"} -->
<div class="wp-block-group orphic-motion-animation" data-animation-type="fadeIn" data-animation-distance="50" data-animation-duration="300" data-animation-delay="200" data-animation-trigger="30" data-scroll-behavior="playOnView"><!-- wp:heading {"textAlign":"center","level":1} -->
<h1 class="wp-block-heading has-text-align-center">' . $homeHeroPatternParams['main_title'] . '</h1>
<!-- /wp:heading -->

<!-- wp:heading {"textAlign":"center"} -->
<h2 class="wp-block-heading has-text-align-center">' . $homeHeroPatternParams['subtitle'] . '</h2>
<!-- /wp:heading -->';

  if ($homeHeroPatternParams['buttons'] && count($homeHeroPatternParams['buttons'])) {
    $heroContent .= '<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} -->
<div class="wp-block-buttons">';
    foreach ($homeHeroPatternParams['buttons'] as $button) {
      $heroContent .= '<!-- wp:button {"style":{"typography":{"lineHeight":"2.1"}}} -->
    <div class="wp-block-button" style="line-height:2.1"><a href="' . $button['url'] . '" class="wp-block-button__link wp-element-button">' . $button['title'] . '</a></div>
    <!-- /wp:button -->
    ';
    }
    $heroContent .= '</div>
  <!-- /wp:buttons -->';
  }

  $heroContent .=  '</div>
<!-- /wp:group -->

<!-- wp:spacer {"height":"90px"} -->
<div style="height:90px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->';

  if ($homeHeroPatternParams['variation'] == 'premium' && $homeHeroPatternParams['price_card']) {
    $heroContent .=  '<!-- wp:group {"layout":{"type":"constrained","contentSize":"600px"},"hasAnimation":true,"animationType":"fadeInBottom","animationDistance":50,"animationDuration":300,"animationDelay":500,"triggerPoint":10,"scrollBehavior":"playOnView"} -->
<div class="wp-block-group orphic-motion-animation" data-animation-type="fadeInBottom" data-animation-distance="50" data-animation-duration="300" data-animation-delay="500" data-animation-trigger="10" data-scroll-behavior="playOnView"><!-- wp:acf/price-card {"name":"acf/price-card","data":{"card_title":"' . $homeHeroPatternParams['price_card']['priceCardTitle'] . '","_card_title":"field_659e0a8f99b7e","has_live_pricing":"1","_has_live_pricing":"field_659e0cb6e1f20","theme":"accelerator","_theme":"field_6769b2d41153d"},"mode":"preview"} -->
<!-- wp:paragraph {"align":"center"} -->
<p class="has-text-align-center">' . $homeHeroPatternParams['price_card']['priceCardDescription'] . '</p>
<!-- /wp:paragraph -->

<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button {"width":100,"className":"is-style-fill"} -->
<div class="wp-block-button has-custom-width wp-block-button__width-100 is-style-fill"><a href="' . $homeHeroPatternParams['price_card']['selectedService'] . '" class="wp-block-button__link wp-element-button">' . $homeHeroPatternParams['price_card']['priceCardLinkText'] . '</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->
<!-- /wp:acf/price-card --></div>
<!-- /wp:group -->';
  } else {
    $heroContent .= '<!-- wp:spacer {"height":"90px"} -->
<div style="height:90px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->';
  }

  $heroContent .=  '<!-- /wp:acf/home-hero -->';
} else {
  if ($homeHeroPatternParams['variation'] == 'premium' && $homeHeroPatternParams['price_card']) {
    $heroContent .= '<!-- wp:acf/home-hero {"name":"acf/home-hero","data":{"theme":"ace","_theme":"field_677856271d740","image":' . $homeHeroPatternParams['image_id'] . ',"_image":"field_677993ccbf6d5","overlay_opacity":"1","_overlay_opacity":"field_6599a19918f5d",' . $sellingPoints . ',"selling_points_background_color":"","_selling_points_background_color":"field_6778ad0ee7dbc","selling_points_color":"","_selling_points_color":"field_6599a8666224f"},"mode":"preview","metadata":{"categories":["miocommerce-pattern"],"patternName":"olympus/home-banner-ace","name":"Home Banner (Ace)"}} -->
<!-- wp:spacer {"height":"60px"} -->
<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:columns {"verticalAlignment":"center","style":{"spacing":{"blockGap":{"top":"var:preset|spacing|60","left":"var:preset|spacing|60"}}}} -->
<div class="wp-block-columns are-vertically-aligned-center"><!-- wp:column {"verticalAlignment":"center","width":"60%","style":{"spacing":{"blockGap":"var:preset|spacing|40"}},"hasAnimation":true,"animationType":"fadeIn","animationDistance":50,"animationDuration":300,"animationDelay":0,"triggerPoint":30,"scrollBehavior":"playOnView"} -->
<div class="wp-block-column is-vertically-aligned-center orphic-motion-animation" style="flex-basis:60%" data-animation-type="fadeIn" data-animation-distance="50" data-animation-duration="300" data-animation-delay="0" data-animation-trigger="30" data-scroll-behavior="playOnView"><!-- wp:heading {"textAlign":"left","level":1} -->
<h1 class="wp-block-heading has-text-align-left">' . $homeHeroPatternParams['main_title'] . '</h1>
<!-- /wp:heading -->

<!-- wp:heading {"textAlign":"left"} -->
<h2 class="wp-block-heading has-text-align-left">' . $homeHeroPatternParams['subtitle'] . '</h2>
<!-- /wp:heading -->';

    if ($homeHeroPatternParams['buttons'] && count($homeHeroPatternParams['buttons'])) {
      $heroContent .= '<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"left"}} -->
<div class="wp-block-buttons">';
      foreach ($homeHeroPatternParams['buttons'] as $button) {
        $heroContent .= '<!-- wp:button {"style":{"typography":{"lineHeight":"2.1"}}} -->
  <div class="wp-block-button" style="line-height:2.1"><a href="' . $button['url'] . '" class="wp-block-button__link wp-element-button">' . $button['title'] . '</a></div>
  <!-- /wp:button -->
  ';
      }
      $heroContent .= '</div>
<!-- /wp:buttons -->';
    }

    $heroContent .= '</div>
<!-- /wp:column -->

<!-- wp:column {"verticalAlignment":"center","width":"40%","hasAnimation":true,"animationType":"fadeIn","animationDistance":50,"animationDuration":300,"animationDelay":0,"triggerPoint":30,"scrollBehavior":"playOnView"} -->
<div class="wp-block-column is-vertically-aligned-center orphic-motion-animation" style="flex-basis:40%" data-animation-type="fadeIn" data-animation-distance="50" data-animation-duration="300" data-animation-delay="0" data-animation-trigger="30" data-scroll-behavior="playOnView">';

    $heroContent .=  '<!-- wp:acf/price-card {"name":"acf/price-card","data":{"card_title":"' . $homeHeroPatternParams['price_card']['priceCardTitle'] . '","_card_title":"field_659e0a8f99b7e","has_live_pricing":"1","_has_live_pricing":"field_659e0cb6e1f20","theme":"ace","_theme":"field_6769b2d41153d"},"mode":"preview"} -->
  <!-- wp:paragraph {"align":"center"} -->
  <p class="has-text-align-center">' . $homeHeroPatternParams['price_card']['priceCardDescription'] . '</p>
  <!-- /wp:paragraph -->
  
  <!-- wp:buttons -->
  <div class="wp-block-buttons"><!-- wp:button {"width":100,"className":"is-style-fill"} -->
  <div class="wp-block-button has-custom-width wp-block-button__width-100 is-style-fill"><a href="' . $homeHeroPatternParams['price_card']['selectedService'] . '" class="wp-block-button__link wp-element-button">' . $homeHeroPatternParams['price_card']['priceCardLinkText'] . '</a></div>
  <!-- /wp:button --></div>
  <!-- /wp:buttons -->
  <!-- /wp:acf/price-card -->';

    $heroContent .= '</div>
<!-- /wp:column --></div>
<!-- /wp:columns -->

<!-- wp:spacer {"height":"60px"} -->
<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- /wp:acf/home-hero -->';
  } else {
    $heroContent .= '<!-- wp:acf/home-hero {"name":"acf/home-hero","data":{"theme":"ace","_theme":"field_677856271d740","image":' . $homeHeroPatternParams['image_id'] . ',"_image":"field_677993ccbf6d5","overlay_opacity":"1","_overlay_opacity":"field_6599a19918f5d",' . $sellingPoints . ',"selling_points_background_color":"","_selling_points_background_color":"field_6778ad0ee7dbc","selling_points_color":"","_selling_points_color":"field_6599a8666224f"},"mode":"preview","metadata":{"categories":["miocommerce-pattern"],"patternName":"olympus/home-banner-ace","name":"Home Banner (Ace)"}} -->
<!-- wp:spacer {"height":"60px"} -->
<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->

<!-- wp:group {"style":{"spacing":{"blockGap":"var:preset|spacing|50"}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group"><!-- wp:heading {"textAlign":"center","level":1} -->
<h1 class="wp-block-heading has-text-align-center">' . $homeHeroPatternParams['main_title'] . '</h1>
<!-- /wp:heading -->

<!-- wp:heading {"textAlign":"center"} -->
<h2 class="wp-block-heading has-text-align-center">' . $homeHeroPatternParams['subtitle'] . '</h2>
<!-- /wp:heading -->';

    if ($homeHeroPatternParams['buttons'] && count($homeHeroPatternParams['buttons'])) {
      $heroContent .= '<!-- wp:buttons {"layout":{"type":"flex","justifyContent":"center"}} -->
<div class="wp-block-buttons">';
      foreach ($homeHeroPatternParams['buttons'] as $button) {
        $heroContent .= '<!-- wp:button {"style":{"typography":{"lineHeight":"2.1"}}} -->
<div class="wp-block-button" style="line-height:2.1"><a href="' . $button['url'] . '" class="wp-block-button__link wp-element-button">' . $button['title'] . '</a></div>
<!-- /wp:button -->
';
      }
      $heroContent .= '</div>
<!-- /wp:buttons -->';
    }

    $heroContent .= '</div>
<!-- /wp:group -->

<!-- wp:spacer {"height":"60px"} -->
<div style="height:60px" aria-hidden="true" class="wp-block-spacer"></div>
<!-- /wp:spacer -->
<!-- /wp:acf/home-hero -->';
  }
}

return $heroContent;
