<?php defined('BASEPATH') or exit('No direct script access allowed');

/**
 * Home Page controller.
 *
 * @package Controllers
 */
class Home_directions extends EA_Controller
{
    /**
     * Render the booking page.
     *
     * This method creates the appointment book wizard.
     */
    public function index(): void
    {
        $company_name = setting('company_name');
        $company_logo = setting('company_logo');
        $company_color = setting('company_color');
        $google_analytics_code = setting('google_analytics_code');
        $matomo_analytics_url = setting('matomo_analytics_url');
        $matomo_analytics_site_id = setting('matomo_analytics_site_id');
        $display_login_button = setting('display_login_button');
        $theme = request('theme', setting('theme', 'default'));

        if (empty($theme) || !file_exists(__DIR__ . '/../../assets/css/themes/' . $theme . '.min.css')) {
            $theme = 'default';
        }    

        script_vars([
            'future_booking_limit' => setting('future_booking_limit'),
            'default_language' => setting('default_language'),
        ]);

        html_vars([
            'theme' => $theme,
            'company_name' => $company_name,
            'company_logo' => $company_logo,
            'company_color' => $company_color === '#ffffff' ? '' : $company_color,
            'display_login_button' => $display_login_button,
            'google_analytics_code' => $google_analytics_code,
            'matomo_analytics_url' => $matomo_analytics_url,
            'matomo_analytics_site_id' => $matomo_analytics_site_id,
        ]);

        $this->load->view('pages/home_directions');
    }

}
