<?php
require __DIR__.'/_bootstrap.php';

use Zoo\Database;
use Zoo\Admin\AdminApiAuth;
use Zoo\Room\RoomManagerService;

try {
    AdminApiAuth::requireKey();
    $manager=new RoomManagerService(Database::connect());

    json_out([
        'ok'=>true,
        'rooms'=>$manager->stats()
    ]);
} catch(Throwable $e) {
    json_out(['ok'=>false,'error'=>$e->getMessage()],403);
}
