-- lua_sen/router.lua: Route definitions
-- Thin wrapper — routes are stored in the CLI definition table
-- and dispatched by the Rust host.

local M = {}

local Router = {}
Router.__index = Router

function M.new()
    return setmetatable({ _routes = {} }, Router)
end

function Router:route(name, handler)
    self._routes[name] = handler
    return self
end

function Router:apply(app_builder)
    for name, handler in pairs(self._routes) do
        app_builder:route(name, handler)
    end
    return app_builder
end

return M
