<?php

try {
    require realpath(dirname(__FILE__) . '/../../helper_functions/data_request.php');
    $vinylTypes = [
        'plastic' => 'Plastic',
        'matte' => 'Matte',
        'glossy' => 'Glossy',
        'transparent' => 'Transparent',
        'holographic' => 'Holographic'
    ];
    $allProperties = fetchData('properties');

    $editedQrTemplates = fetchData('qr_code_templates',['is_default' => null,'property_id' => $_SESSION['property']??' ']);
    $defaultQrTemplates = fetchData('qr_code_templates',['is_default' => 1]);
    $editedNames = array_column($editedQrTemplates, 'templateName');
    $FilteredQrTemplates = array_filter($defaultQrTemplates, function ($template) use ($editedNames) {
    return !in_array($template['templateName'], $editedNames);
    });
    $allTemplates = array_merge($editedQrTemplates, $FilteredQrTemplates);


    // $allTemplates = fetchData('qr_code_templates');
} catch (\Throwable $th) {
    error_log("QR code essentials error: " . $th->getMessage());
    echo "An unexpected error occurred.";
    exit;
}
