<?php

namespace AmbassadorHub\Accounts;

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Abstract Capabilities class for Accounts
 *
 * Provides a base class for defining capabilities related to accounts, such as those for ambassadors and administrators.
 * Modules can extend this class to add their own capabilities and ensure they are registered properly.
 *
 * @package AmbassadorHub\Accounts
 * @since 0.1.0
 * @see Roles for how capabilities are applied to roles and filtered.
 *
 * Usage:
 * - Create a new class that extends AbstractCapabilities.
 * - Implement static methods to return capabilities for admins, ambassadors, and unverified ambassadors.
 * - Call the register() method to hook into the capability registration process.
 *
 */
abstract class AbstractCapabilities {

	public static function register() {

		add_filter( 'ambh_admin_caps', array( static::class, 'admin_caps' ) );
		add_filter( 'ambh_ambassador_caps', array( static::class, 'ambassador_caps' ) );
		add_filter( 'ambh_unverified_ambassador_blocked_caps', array( static::class, 'unverified_ambassador_blocked_caps' ) );
	}

	/**
	 * Get capabilities for WordPress administrators.
	 *
	 * @param string[] $caps Existing capabilities.
	 * @return string[] Modified capabilities.
	 */
	public static function admin_caps( $caps ): array {
		return $caps;
	}


	/**
	 * Get capabilities for ambassadors.
	 *
	 * @param string[] $caps Existing capabilities.
	 * @return string[] Modified capabilities.
	 */
	public static function ambassador_caps( $caps ): array {
		return $caps;
	}


	/**
	 * Get capabilities that are blocked for unverified ambassadors.
	 *
	 * @param string[] $caps Existing blocked capabilities.
	 * @return string[] Modified blocked capabilities.
	 */
	public static function unverified_ambassador_blocked_caps( $caps ): array {
		return $caps;
	}
}
