<?php

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template variables passed via extract().
$grid_template_rows    = isset( $grid_template_rows ) ? $grid_template_rows : [];
$grid_template_columns = isset( $grid_template_columns ) ? $grid_template_columns : [];
$available_hours       = isset( $available_hours ) ? $available_hours : [];
$week_is_visible       = isset( $week_is_visible ) ? $week_is_visible : true;
$day_is_visible        = isset( $day_is_visible ) ? $day_is_visible : true;
$hidden_columns        = isset( $hidden_columns ) ? $hidden_columns : [];
$marker_visible        = isset( $marker_visible ) ? $marker_visible : false;
// phpcs:enable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
?>
<style id="sugar-calendar-bookings-calendar-styles">
    .sugar-calendar-bookings-calendar__content {
        grid-template-rows: <?php echo esc_attr( implode( ' ', $grid_template_rows ) ); ?>;
        grid-auto-rows: 0;
    }

	<?php if ( ! empty( $grid_template_columns ) ) : ?>

    .sugar-calendar-bookings-calendar__header,
    .sugar-calendar-bookings-calendar__content,
    .sugar-calendar-bookings-calendar__footer {
        grid-template-columns: <?php echo esc_attr( implode( ' ', $grid_template_columns ) ); ?>;
    }

	<?php endif; ?>

    .sugar-calendar-bookings-calendar__content {
	<?php echo esc_attr( implode( ',', $available_hours ) ); ?> {
        --enabled: 100%;
    }
    }

	<?php if ( $marker_visible ) : ?>

    .sugar-calendar-bookings-calendar__current-time-line {
        display: block !important;
        grid-column-start: <?php echo esc_attr( $week_is_visible ? 2 : 1 ); ?>;
    }

	<?php
	endif;

	// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Template variable in foreach loop.
	foreach ( $hidden_columns as $column ) :
	?>

    .sugar-calendar-bookings-calendar__cell--<?php echo esc_attr( $column ); ?> {
        display: none !important;
    }

	<?php endforeach; ?>
</style>
