<?php
/**
 * Sports Leagues :: Shortcode > Tournament Header.
 *
 * @since   0.5.5
 * @package Sports_Leagues
 */

/**
 * Sports Leagues :: Shortcode > Tournament Header.
 *
 * @since 0.5.5
 * @since 0.14.1 Refactored to extend Sports_Leagues_Shortcode_Base.
 */
class Sports_Leagues_Shortcode_Tournament_Header extends Sports_Leagues_Shortcode_Base {

	/**
	 * Get the shortcode tag.
	 *
	 * @return string
	 * @since 0.14.1
	 */
	protected function get_shortcode_tag(): string {
		return 'sl-tournament-header';
	}

	/**
	 * Get the shortcode key for options/hooks.
	 *
	 * @return string
	 * @since 0.14.1
	 */
	protected function get_shortcode_key(): string {
		return 'tournament-header';
	}

	/**
	 * Get the shortcode label for UI.
	 *
	 * @return string
	 * @since 0.14.1
	 */
	protected function get_shortcode_label(): string {
		return __( 'Tournament Header', 'sports-leagues' );
	}

	/**
	 * Get default attribute values.
	 *
	 * @return array
	 * @since 0.14.1
	 */
	protected function get_defaults(): array {
		return [
			'title_as_link'   => 0,
			'tournament_id'   => '',
			'stage_id'        => '',
			'season_selector' => 0,
		];
	}

	/**
	 * Get documentation URL.
	 *
	 * @return string
	 * @since 0.14.1
	 */
	protected function get_docs_url(): string {
		return 'https://anwppro.userecho.com/knowledge-bases/6/articles/151-tournament-header-shortcode';
	}

	/**
	 * Get default preview width.
	 *
	 * @return int
	 * @since 0.14.1
	 */
	protected function get_default_preview_width(): int {
		return 700;
	}

	/**
	 * Get form field definitions.
	 *
	 * @return array
	 * @since 0.14.1
	 */
	protected function get_form_fields(): array {
		return [
			[
				'type'     => 'selector',
				'name'     => 'tournament_id',
				'label'    => __( 'Tournament', 'sports-leagues' ),
				'entity'   => 'tournament',
				'multiple' => false,
			],
			[
				'type'     => 'selector',
				'name'     => 'stage_id',
				'label'    => __( 'Tournament Stage', 'sports-leagues' ),
				'entity'   => 'stage',
				'multiple' => false,
			],
			[
				'type'    => 'yes_no',
				'name'    => 'title_as_link',
				'label'   => __( 'Title as a Link', 'sports-leagues' ),
				'default' => '0',
			],
			[
				'type'    => 'yes_no',
				'name'    => 'season_selector',
				'label'   => __( 'Show Season Selector', 'sports-leagues' ),
				'default' => '0',
			],
		];
	}
}
