<?php
/**
 * Step: send yourself a test message.
 *
 * @package TextTango
 *
 * @var array<string, mixed> $args           View data.
 * @var array<string, mixed> $texttango_step This step's state.
 */

declare( strict_types=1 );

defined( 'ABSPATH' ) || exit;

$texttango_blocked = ! empty( $texttango_step['blocked'] ) && empty( $texttango_step['done'] );
?>
<p class="tt-stage-lead">
	<?php esc_html_e( 'The only thing that proves the whole path works — token, sender ID, network and handset. A simulated send cannot.', 'texttango' ); ?>
</p>

<?php if ( $texttango_blocked ) : ?>
	<div class="tt-notice tt-notice-warn">
		<?php esc_html_e( 'Connect your account first — there is nothing to send with until a token works.', 'texttango' ); ?>
	</div>
<?php else : ?>
	<div class="tt-notice tt-notice-warn tt-mb-5">
		<strong><?php esc_html_e( 'This sends a real SMS.', 'texttango' ); ?></strong>
		<?php esc_html_e( 'It uses credit from your balance, and it goes out even when sandbox mode is on — proving the live path is the whole point.', 'texttango' ); ?>
	</div>

	<label class="tt-label" for="texttango-wizard-phone"><?php esc_html_e( 'Your phone number', 'texttango' ); ?></label>
	<input
		class="tt-input"
		id="texttango-wizard-phone"
		type="tel"
		autocomplete="tel"
		placeholder="+233 24 123 4567"
		value="<?php echo esc_attr( (string) $args['test_phone'] ); ?>"
		data-texttango-test-phone />
	<p class="tt-hint">
		<?php esc_html_e( 'Local formats are fine — the number is turned into E.164 before it is sent.', 'texttango' ); ?>
	</p>

	<div class="tt-stage-actions">
		<button type="button" class="tt-btn tt-btn-primary" data-texttango-action="send-test-sms">
			<?php esc_html_e( 'Send a test SMS', 'texttango' ); ?>
		</button>
	</div>

	<p class="tt-text-sm tt-mt-3" data-texttango-test-result aria-live="polite"></p>
<?php endif; ?>
