import { Schema as S } from "@effect/schema"; // --- INTERFACES -------------------------------------------------------------- export interface RouteLiteral { readonly _tag: "Literal"; readonly literal: Literal; } export interface RouteParam> { readonly _tag: "Param"; readonly name: Name; readonly schema: Schema; } export namespace RouteLiteral { export type Any = RouteLiteral; } export namespace RouteParam { export type Any = RouteParam>; } export namespace Route { export type Any = readonly ( | RouteLiteral.Any | RouteParam.Any )[]; } // --- CONSTRUCTORS ------------------------------------------------------------ export const RouteLiteral = (literal: Literal): RouteLiteral => Object.freeze>({ _tag: "Literal", literal, }); export const RouteParam = >(name: Name, schema: Schema): RouteParam => Object.freeze>({ _tag: "Param", name, schema, }); export const Route = (...route: Route): Route => Object.freeze(route);