<?php
defined('ABSPATH') || exit;
/**
 * New booking request email template.
 *
 * Expected variables:
 * - $provider, $service, $date, $owner, $email
 * - Optional: $dashboard_url, $manage_booking_url, $add_to_calendar_url
 * - Optional: $date_to when using day interval
 */
/* translators: %s: service name */
$bookaro_subject = sprintf( __( 'New booking request: %s', 'mybookaro' ), $service );
$bookaro_preheader = __( 'A new booking request needs your attention.', 'mybookaro' );
require bookaro_locate_template( 'templates/emails/partials/header.php' );
?>

<h2 style="font-size:20px; margin-bottom:12px;"><?php esc_html_e( 'New booking request', '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: provider, 2: service, 3: date or range, 4: owner, 5: email */
    __( 'Hello %1$s, you have a new booking for "%2$s" on %3$s from %4$s (%5$s).', 'mybookaro' ),
    (string) $provider,
    (string) $service,
    (string) $bookaro_date_display,
    (string) $owner,
    (string) $email
);
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,
    ];
}
if ( $owner || $email ) {
    $bookaro_details[ esc_html__( 'From', 'mybookaro' ) ] = trim( $owner . ' (' . $email . ')' );
}
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' ); ?>
