<?php
defined('ABSPATH') || exit;
/**
 * Review invite email template.
 *
 * Expected variables: $owner_name, $booking_date, $review_link
 * Optional: $booking_date_to when using day interval
 */
$bookaro_subject = __( 'We would love your feedback!', 'mybookaro' );
$bookaro_preheader = __( 'Please rate your recent booking experience.', 'mybookaro' );
require bookaro_locate_template( 'templates/emails/partials/header.php' );
?>

<h2 style="font-size:20px; margin-bottom:12px;"><?php esc_html_e( 'How was your experience?', 'mybookaro' ); ?></h2>

<?php
$bookaro_date_display = $booking_date;
if ( ! empty( $booking_date_to ) ) {
    $bookaro_date_display = sprintf(
        /* translators: 1: start date, 2: end date */
        esc_html__( '%1$s to %2$s', 'mybookaro' ),
        $booking_date,
        $booking_date_to
    );
}
$bookaro_intro_fallback = sprintf(
    /* translators: 1: owner name, 2: booking date or range */
    __( 'Hi %1$s, thank you for completing your booking on %2$s.', 'mybookaro' ),
    (string) $owner_name,
    (string) $bookaro_date_display
);
require bookaro_locate_template( 'templates/emails/partials/intro.php' );

$bookaro_details = isset( $bookaro_details ) && is_array( $bookaro_details ) ? $bookaro_details : [];
if ( empty( $bookaro_details ) ) {
    $bookaro_details = [];
}
if ( ! empty( $service ) ) {
    $bookaro_details[ esc_html__( 'Service', 'mybookaro' ) ] = (string) $service;
}
if ( ! empty( $provider ) ) {
    $bookaro_details[ esc_html__( 'Provider', 'mybookaro' ) ] = (string) $provider;
}
if ( empty( $bookaro_details[ esc_html__( 'Date', 'mybookaro' ) ] ) ) {
    $bookaro_details[ esc_html__( 'Date', 'mybookaro' ) ] = $bookaro_date_display;
}
if ( ! empty( $review_link ) ) {
    $bookaro_details[ esc_html__( 'Review link', 'mybookaro' ) ] = (string) $review_link;
}
require bookaro_locate_template( 'templates/emails/partials/booking-details.php' );
require bookaro_locate_template( 'templates/emails/partials/contact-details.php' );
require bookaro_locate_template( 'templates/emails/partials/timezone.php' );
require bookaro_locate_template( 'templates/emails/partials/policy-snippet.php' );
?>

<p>
    <?php
    echo sprintf(
        /* translators: 1: booking date or range */
        esc_html__( 'Please leave a quick review for your booking on %1$s using the button below.', 'mybookaro' ),
        esc_html( $bookaro_date_display )
    );
    ?>
</p>

<p style="text-align:center;">
    <a href="<?php echo esc_url( $review_link ); ?>" class="btn">
        <?php esc_html_e( 'Leave a review', 'mybookaro' ); ?>
    </a>
</p>

<?php require bookaro_locate_template( 'templates/emails/partials/booking-actions.php' ); ?>

<?php require bookaro_locate_template( 'templates/emails/partials/footer.php' ); ?>
