<?php
/**
 * Unknown reward type implementation for unsupported types.
 *
 * @package Awesomemotive\Rewardswp\RewardTypes
 * @since 1.0.0
 */

namespace Awesomemotive\Rewardswp\RewardTypes;

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

use Awesomemotive\Rewardswp\Interfaces\RewardTypeInterface;
use Awesomemotive\Rewardswp\Models\Referral;
use Awesomemotive\Rewardswp\Models\Reward;

class UnknownRewardType implements RewardTypeInterface {
	/**
	 * Get reward type slug.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public function get_type(): string {
		return 'unknown';
	}

	/**
	 * Get admin title.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public function get_admin_title(): string {
		return __( 'Unknown Reward', 'rewardswp' );
	}

	/**
	 * Get panel title.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public function get_panel_title(): string {
		return __( 'Reward', 'rewardswp' );
	}

	/**
	 * Get panel subtitle.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public function get_panel_subtitle(): string {
		return __( 'Something went wrong', 'rewardswp' );
	}

	/**
	 * Get panel instructions.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public function get_panel_instructions(): string {
		return __( 'Failed to render reward. Please contact the site administrator.', 'rewardswp' );
	}

	/**
	 * Get icon name.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public function get_icon_name(): string {
		return 'gift';
	}

	/**
	 * Get supported integrations.
	 *
	 * @since 1.0.0
	 *
	 * @return array
	 */
	public function available_for(): array {
		return [];
	}

	/**
	 * Get default configuration.
	 *
	 * @since 1.0.0
	 *
	 * @return int[]
	 */
	public function get_defaults(): array {
		return [];
	}

	/**
	 * Get admin title for advocate.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public function get_admin_advocate_title(): string {
		return __( 'Not available', 'rewardswp' );
	}

	/**
	 * Get admin title for friend.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public function get_admin_friend_title(): string {
		return __( 'Not available', 'rewardswp' );
	}

	/**
	 * Claim a reward.
	 *
	 * @since 1.0.0
	 *
	 * @param array $args
	 *
	 * @return Reward|null
	 */
	public function claim_reward( array $args = [] ): ?Reward {
		return null;
	}

	/**
	 * Issue a reward.
	 *
	 * @since 1.0.0
	 *
	 * @param Referral $referral
	 * @param string   $recipient_type
	 * @param array    $args
	 *
	 * @return Reward|null
	 */
	public function issue_reward( Referral $referral, string $recipient_type, array $args = [] ): ?Reward {
		return null;
	}

	/**
	 * Redeem a reward.
	 *
	 * @since 1.0.0
	 *
	 * @param Reward $reward
	 * @param array  $args
	 *
	 * @return bool|null
	 */
	public function redeem_reward( Reward $reward, array $args = [] ): ?bool {
		return false;
	}

	/**
	 * Get formatted amount label.
	 *
	 * @since 1.0.0
	 *
	 * @param float  $amount Optional. Unused for unknown types.
	 * @param string $format Optional. Format identifier. Default 'default'.
	 *
	 * @return string
	 */
	public function get_reward_formatted_amount( float $amount = 0, string $format = 'default' ): string {
		switch ( $format ) {
			case 'value_only':
			default:
				return $this->get_admin_title();
		}
	}

	/**
	 * Prepare rewards for view rendering.
	 *
	 * @since 1.0.0
	 *
	 * @param Reward[] $rewards
	 *
	 * @return array
	 */
	public function prepare_rewards_objects_for_view( array $rewards, array $args = [] ): array {
		return [];
	}

	/**
	 * Get empty rewards content.
	 *
	 * @since 1.0.0
	 *
	 * @return string
	 */
	public function get_empty_rewards_content(): string {
		return esc_html__( 'Unknown reward type', 'rewardswp' );
	}

	/**
	 * Returns the content to display the claiming panel.
	 *
	 * @since 1.0.0
	 *
	 * @param array $args
	 *
	 * @return string
	 */
	public function get_claim_panel_content( array $args = [] ): string {
		return '';
	}
}
