<html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><html><link rel='icon' href='https://e.top4top.io/p_26973oc9i1.png' sizes='20x20' type='image/png'><?php

namespace Automattic\WooCommerce\Internal\Admin\BlockTemplates;

/**
 * Trait for block formatted template.
 */
trait BlockFormattedTemplateTrait {
	/**
	 * Get the block configuration as a formatted template.
	 *
	 * @return array The block configuration as a formatted template.
	 */
	public function get_formatted_template(): array {
		$arr = array(
			$this->get_name(),
			array_merge(
				$this->get_attributes(),
				array(
					'_templateBlockId'    => $this->get_id(),
					'_templateBlockOrder' => $this->get_order(),
				),
				! empty( $this->get_hide_conditions() ) ? array(
					'_templateBlockHideConditions' => $this->get_formatted_hide_conditions(),
				) : array(),
				! empty( $this->get_disable_conditions() ) ? array(
					'_templateBlockDisableConditions' => $this->get_formatted_disable_conditions(),
				) : array(),
			),
		);

		return $arr;
	}

	/**
	 * Get the block hide conditions formatted for inclusion in a formatted template.
	 */
	private function get_formatted_hide_conditions(): array {
		return $this->format_conditions( $this->get_hide_conditions() );
	}

	/**
	 * Get the block disable conditions formatted for inclusion in a formatted template.
	 */
	private function get_formatted_disable_conditions(): array {
		return $this->format_conditions( $this->get_disable_conditions() );
	}

	/**
	 * Formats condition