<?php

declare(strict_types=1);

namespace Australcode\Rewards\Domain\License;

defined( 'ABSPATH' ) || exit;

/**
 * License tiers, governed by Freemius. Backed by string for stable persistence.
 *
 * The model is Free/Pro only — there is no Agency tier (product decision: the
 * plugin ships and stays a two-tier Free/Pro product). Site limits and pricing
 * (annual/lifetime × sites) are enforced and published by Freemius per plan; the
 * plugin does not model them. The enum only captures the two capability states
 * that gating needs:
 *
 *   - Free — no usable license (WP.org download, Pro features off).
 *   - Pro  — unlocks every Pro feature.
 *
 * Per the hub licensing canon (wp-plugin-architecture/references/licensing.md),
 * the active plan resolves from the Freemius SDK (can_use_premium_code()).
 * LicenseGate::is_pro_active() returns false for Free; LicenseGate::tier()
 * returns Pro when premium is active and null otherwise (the Free state).
 */
enum LicenseTier: string {

	case Free = 'free';
	case Pro  = 'pro';

	/**
	 * Human-readable tier name, ready for UI. Stable cross-locale (the commercial
	 * tier name is the same in any plugin language).
	 */
	public function label(): string {
		return match ( $this ) {
			self::Free => 'Free',
			self::Pro  => 'Pro',
		};
	}
}
