<?php
defined('ABSPATH') || exit;
/**
 * Booking rejected notification.
 *
 * Expected variables:
 * - $owner, $service, $date, $provider
 * - Optional: $date_to when using day interval
 */
$bookaro_subject = __( 'Your booking is rejected', 'mybookaro' );
$bookaro_preheader = __( 'Your booking request was not approved.', 'mybookaro' );
require bookaro_locate_template( 'templates/emails/partials/header.php' );
?>

<h2 style="font-size:20px; margin-bottom:12px;"><?php esc_html_e( 'Booking rejected', 'mybookaro' ); ?></h2>
<?php
$bookaro_date_display = $date;
if ( ! empty( $date_to ) ) {
    $bookaro_date_display = sprintf(
        /* translators: 1: start date, 2: end date */
        __( '%1$s to %2$s', 'mybookaro' ),
        $date,
        $date_to
    );
}
$bookaro_intro_fallback = sprintf(
    /* translators: 1: owner, 2: service, 3: date or range, 4: provider */
    __( 'Hello %1$s, we are sorry but your booking for "%2$s" on %3$s was rejected by %4$s.', 'mybookaro' ),
    (string) $owner,
    (string) $service,
    (string) $bookaro_date_display,
    (string) $provider
);
require bookaro_locate_template( 'templates/emails/partials/intro.php' );
?>
<?php
$bookaro_details = isset( $bookaro_details ) && is_array( $bookaro_details ) ? $bookaro_details : [];
if ( empty( $bookaro_details ) ) {
    $bookaro_details = [
        esc_html__( 'Service', 'mybookaro' )  => $service,
        esc_html__( 'Date', 'mybookaro' )     => $bookaro_date_display,
        esc_html__( 'Provider', 'mybookaro' ) => $provider,
    ];
}
if ( isset( $reason ) && $reason !== '' ) {
    $bookaro_details[ esc_html__( 'Reason', 'mybookaro' ) ] = $reason;
}
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' );
require bookaro_locate_template( 'templates/emails/partials/booking-actions.php' );
?>

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