<?php
/**
 * Sports Leagues :: Shortcode > Roster.
 *
 * @since   0.14.0
 * @package Sports_Leagues
 */

/**
 * Sports Leagues :: Shortcode > Roster.
 *
 * @since 0.14.0
 * @since 0.14.1 Refactored to extend Sports_Leagues_Shortcode_Base.
 */
class Sports_Leagues_Shortcode_Roster extends Sports_Leagues_Shortcode_Base {

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

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

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

	/**
	 * Get default attribute values.
	 *
	 * @return array
	 * @since 0.14.1
	 */
	protected function get_defaults(): array {
		return [
			'title'     => '',
			'season_id' => '',
			'team_id'   => '',
			'layout'    => '',
			'header'    => false,
		];
	}

	/**
	 * Get documentation URL.
	 *
	 * @return string
	 * @since 0.14.1
	 */
	protected function get_docs_url(): string {
		return 'https://anwp.pro/docs/sports-leagues/3-display-shortcodes/roster/';
	}

	/**
	 * 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'     => 'season_id',
				'label'    => __( 'Season ID', 'sports-leagues' ),
				'entity'   => 'season',
				'multiple' => false,
			],
			[
				'type'     => 'selector',
				'name'     => 'team_id',
				'label'    => __( 'Team ID', 'sports-leagues' ),
				'entity'   => 'team',
				'multiple' => false,
			],
			[
				'type'    => 'text',
				'name'    => 'title',
				'label'   => __( 'Title', 'sports-leagues' ),
				'default' => '',
			],
			[
				'type'    => 'select',
				'name'    => 'layout',
				'label'   => __( 'Layout', 'sports-leagues' ),
				'default' => '',
				'options' => [
					''     => __( 'default', 'sports-leagues' ),
					'grid' => __( 'grid', 'sports-leagues' ),
				],
			],
		];
	}
}
