const std = @import("std");
const zap = @import("zap");

const web = @import("../../root.zig");

pub const Display = @import("Display.zig");

pub fn init(allocator: std.mem.Allocator, channels: *web.stores.Channels) void {
    Display.init(allocator, channels);
}

pub fn deinit() void {
    Display.deinit();
}

pub fn onUpgrade(r: zap.Request, target_protocol: []const u8) !void {
    if (r.path == null) {
        r.setStatus(.not_found);
        r.markAsFinished(true);
        return;
    }

    web.endpoints.pathGuard(r, "/api/ws/display") catch return;
    try Display.onUpgrade(r, target_protocol);

    // if (std.mem.eql(u8, path, "/display/ws")) {
    //     try Display.onUpgrade(r, target_protocol);
    //     return;
    // }
}
