<?php
session_start();
require_once "../models/Operations.php";

$session_user_id = $_SESSION["user_id"] ?? "";
$session_user_ent_id = $_SESSION["user_ent_id"] ?? "";
$session_user_pos_id = $_SESSION["user_pos_id"] ?? "";

if (empty($session_user_id) || empty($session_user_ent_id) || empty($session_user_pos_id)) {
    echo "session_expired";
    exit();
} else {

    if (getEnterpriseData($session_user_ent_id)['ent_status'] == "Disabled" && $_SESSION["user_profile"] !== "ROOT") {
        echo "session_expired";
        exit();
    }
}

// if (isset($session_user_ent_id) || isset($session_user_pos_id) || isset($session_user_id)) {
// 	$pusher->trigger('evopos', 'checkActiveSession', 'session_valid');
// } else {
// 	$pusher->trigger('evopos', 'checkActiveSession', 'session_expired');
// }