<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Exit if accessed directly.
}

/**
 * Plain Text Template: Job Order Cancel Response
 *
 * Sent to the user when a cancellation request is accepted or rejected.
 *
 * @var string   $email_heading
 * @var string   $recipient_name
 * @var string   $responder_name
 * @var string   $job_title
 * @var int      $job_id
 * @var int      $order_id
 * @var string   $status
 * @var string   $order_link
 * @var string   $employer_label
 * @var string   $freelancer_label
 * @var bool     $sent_to_admin
 * @var bool     $plain_text
 * @var WC_Email $email
 */

$status_text = ( 'accepted' === $status ) ? esc_html__( 'Accepted', 'gigneo' ) : esc_html__( 'Rejected', 'gigneo' );

echo "=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n";
echo esc_html( wp_strip_all_tags( $email_heading ) );
echo "\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\n\n";

/* Greeting */
printf(
	// translators: %s: Recipient name.
	esc_html__( 'Hello %s,', 'gigneo' ),
	esc_html( $recipient_name )
);
echo "\n\n";

/* Introduction */
printf(
	// translators: %1$s: Responder name, %2$s: Job title, %3$s: Status.
	esc_html__( '%1$s has %3$s your cancellation request for the job order "%2$s".', 'gigneo' ),
	esc_html( $responder_name ),
	esc_html( $job_title ),
	esc_html( strtoupper( $status_text ) )
);
echo "\n\n";

/* Section heading */
echo esc_html__( 'Order summary', 'gigneo' );
echo "\n----------\n\n";

/* Order ID */
echo esc_html__( 'Order ID:', 'gigneo' ) . ' ' . esc_html( gigneo_format_id( $order_id, 'order', false ) );
echo "\n";

/* Job ID */
echo esc_html__( 'Job ID:', 'gigneo' ) . ' ' . esc_html( gigneo_format_id( $job_id, 'job', false ) );
echo "\n";

/* Status */
echo esc_html__( 'Request status:', 'gigneo' ) . ' ' . esc_html( strtoupper( $status_text ) );
echo "\n";

/* Job Title */
echo esc_html__( 'Job title:', 'gigneo' ) . ' ' . esc_html( $job_title );
echo "\n\n";

/* CTA link */
echo esc_html__( 'View order details:', 'gigneo' ) . ' ' . esc_url( $order_link );
echo "\n\n";

/* Closing note */
if ( 'accepted' === $status ) {
	echo esc_html__( 'The order has been successfully cancelled and any refunds will be processed accordingly.', 'gigneo' );
} else {
	echo esc_html__( 'Since the request was rejected, the project remains active.', 'gigneo' );
}
echo "\n\n";

// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedHooknameFound
do_action( 'woocommerce_email_footer', $email );
