
<?php
if (session_status() === PHP_SESSION_NONE) session_start();

try {
    require realpath(dirname(__FILE__) . '/../../helper_functions/data_request.php');
    $device_type = [
        'web_Relay' => 'Web Relay',
        'SMSIO' => 'SMS IO',
    ];

    $door_type = [
        'Gate' => 'Gate',
        'Door' => 'Door',
    ];

    $hardwareProtocols = [
        'HTTP' => 'HTTP',
        'HTTPS' => 'HTTPS',
        'SMTP' => 'SMTP',
    ];

    $webRelayModels = [
        'Original Web Relay 1 I/O Model X-WR-1R12-1I-I' => 'Original Web Relay 1 I/O Model X-WR-1R12-1I-I',
        'X-401 Web Relay 2 I/O Model X-401-I' => 'X-401 Web Relay 2 I/O Model X-401-I',
        'X-412 Web Relay 4 I/O Model X-412-I' => 'X-412 Web Relay 4 I/O Model X-412-I',
        'X-432 Web Relay 16 I/O Model X-432-I'=>'X-432 Web Relay 16 I/O Model X-432-I'
    ];

    $userId = $_SESSION['userid'];
    $userLayer = $_SESSION['layer'];
    $property_id = $_SESSION['property'];
    $propert_phone_numbers = [];
    // if ($userLayer === 'super_admin' || $userLayer === 'admin') {
    //     $my_numbers = fetchData('my_numbers');
    // }else if ($userLayer === 'dealer') {
    //     $my_numbers = fetchData('my_numbers', ['dealer_id' => $userId, 'property_id' => $property_id]);
    // }else if ($userLayer ==='property' || $userLayer ==='property admin'){
        $my_numbers = fetchData('my_numbers', ['property_id' => $property_id, 'deleted_at' => null]);
    // }
    
} catch (\Throwable $th) {
    error_log("Hardware essentials error: " . $th->getMessage());
    echo "An unexpected error occurred.";
    exit;
}
