<?php
require_once 'auth.php';
include 'db.php';
requireLogin($conn);

header('Content-Type: application/json; charset=utf-8');

$code = trim($_GET['code'] ?? '');

if (empty($code)) {
    echo json_encode([
        'status' => 'empty',
        'message' => 'Sila masukkan kod fail.',
        'suggested_code' => '',
        'active_code' => ''
    ]);
    exit();
}

$info = getOfficeFolderJilidInfo($conn, $code);

echo json_encode($info);
