<?php
declare(strict_types=1);

namespace WP_AUX\Enum;

use WP_AUX\Interfaces\OptionsEnumInterface;
use WP_AUX\Traits\EnumTraits;

/**
 * Enum PostQueryTypeEnum represents different types of post queries
 * and provides additional functionality for each type.
 *
 * Implements OptionsEnumInterface and uses EnumTraits to provide
 * shared behaviors and utility methods.
 *
 * @since 1.0.0
 * @link https://www.php.net/manual/en/language.enumerations.overview.php
 */
enum PostQueryTypeEnum: string implements OptionsEnumInterface
{
  use EnumTraits;

  case Standard = 'standard';
  case Related = 'related';
  case Recent = 'recent';

  public const DEFAULT = self::Standard;
  public const SETTING_LABEL = 'Post query type';

  public function label(): string
  {
    return match($this) {
      self::Standard => 'Standard',
      self::Related => 'Related',
      self::Recent => 'Recent',
    };
  }

  /**
   * Get the Wordpress query arguments filter for the current query type
   * @since 1.0.0.
   */
  public function argumentsFilter(): string
  {
    return match($this) {
      self::Standard => '',
      self::Related => 'aux/related_posts_args',
      self::Recent => 'aux/recent_posts_args',
    };
  }
}
