<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Prevent direct access to the script.
}
$profile_id    = ! empty( $args['profile_id'] ) ? $args['profile_id'] : '';
$profile_type  = ! empty( $args['profile_type'] ) ? $args['profile_type'] : '';
$platform_type = ! empty( $args['platform_type'] ) ? $args['platform_type'] : '';
$credit_system = ! empty( $args['credit_system'] ) ? $args['credit_system'] : '';

$wallet_balance    = gigneo_profile_stat( 'wallet_balance', $profile_id );
$available_credits = gigneo_profile_stat( 'available_credits', $profile_id );
$purchased_credits = gigneo_profile_stat( 'purchased_credits', $profile_id );
$used_credits      = gigneo_profile_stat( 'used_credits', $profile_id );
?>
<div id="gn-credit-stats" class="gn-dashboard-section gn-credit-stats">
	<div class="gn-head">
		<div class="gn-heading-info">
			<h2 class="gn-title"><?php echo esc_html__( 'Credits', 'gigneo' ); ?></h2>
			<p class="gn-description"><?php echo esc_html__( 'Track your credit usage and purchasing history.', 'gigneo' ); ?></p>
		</div>
	</div>
	<div class="gn-stat-cards">
		<div class="gn-stat-card gn-wallet-balance">
			<div class="gn-head">
				<span class="gn-icon">
					<i class="hi hi-banknotes" aria-hidden="true"></i>
				</span>
			</div>
			<h3 class="gn-value"><?php echo esc_html( gigneo_price_format( $wallet_balance['lifetime'], true ) ); ?></h3>
			<h6 class="gn-label"><?php echo esc_html__( 'Wallet balance', 'gigneo' ); ?>
				<span class="gn-stat-change gn-<?php echo esc_attr( $wallet_balance['trend'] ); ?>">
					<?php echo esc_html( number_format( $wallet_balance['percentage'] ) . '%' ); ?>
				</span>
			</h6>
		</div>
		<div class="gn-stat-card gn-available-credits">
			<div class="gn-head">
				<span class="gn-icon">
					<i class="hi hi-credit-card" aria-hidden="true"></i>
				</span>
			</div>
			<h3 class="gn-value"><?php echo esc_html( gigneo_price_format( $available_credits['lifetime'], false ) ); ?></h3>
			<h6 class="gn-label"><?php echo esc_html__( 'Available credits', 'gigneo' ); ?>
				<span class="gn-stat-change gn-<?php echo esc_attr( $available_credits['trend'] ); ?>">
					<?php echo esc_html( number_format( $wallet_balance['percentage'] ) . '%' ); ?>
				</span>
			</h6>
		</div>
		<div class="gn-stat-card gn-purchased-credits">
			<div class="gn-head">
				<span class="gn-icon">
					<i class="hi hi-document-currency-dollar" aria-hidden="true"></i>
				</span>
			</div>
			<h3 class="gn-value"><?php echo esc_html( gigneo_price_format( $purchased_credits['lifetime'], false ) ); ?></h3>
			<h6 class="gn-label"><?php echo esc_html__( 'Purchased credits', 'gigneo' ); ?>
				<span class="gn-stat-change gn-<?php echo esc_attr( $purchased_credits['trend'] ); ?>">
					<?php echo esc_html( number_format( $purchased_credits['percentage'] ) . '%' ); ?>
				</span>
			</h6>
		</div>
		<div class="gn-stat-card gn-used-credits">
			<div class="gn-head">
				<span class="gn-icon">
					<i class="hi hi-credit-card" aria-hidden="true"></i>
				</span>
			</div>
			<h3 class="gn-value"><?php echo esc_html( gigneo_price_format( $used_credits['lifetime'], false ) ); ?></h3>
			<h6 class="gn-label"><?php echo esc_html__( 'Used credits', 'gigneo' ); ?>
				<span class="gn-stat-change gn-<?php echo esc_attr( $used_credits['trend'] ); ?>">
					<?php echo esc_html( number_format( $used_credits['percentage'] ) . '%' ); ?>
				</span>
			</h6>
		</div>
	</div>
</div>
