import CasePaths import Foundation @preconcurrency import URLRouting public enum SiteRoute: Equatable, Sendable { case api(Api) case health case view(View) public static let router = OneOf { Route(.case(Self.api)) { Api.router } Route(.case(Self.view)) { View.router } } } public extension SiteRoute { enum Api: Equatable, Sendable { case calculateMoldRisk(MoldRisk.Request) static let rootPath = Path { "api"; "v1" } public static let router = OneOf { Route(.case(Self.calculateMoldRisk)) { Path { "api"; "v1"; "calculateMoldRisk" } Method.post Body(.json(MoldRisk.Request.self)) } } } } public extension SiteRoute { enum View: Equatable, Sendable { case index case moldRisk(MoldRisk) public static let router = OneOf { Route(.case(Self.index)) { Method.get } Route(.case(Self.moldRisk)) { MoldRisk.router } } public enum MoldRisk: Equatable, Sendable { case index static let rootPath = "mold-risk" public static let router = OneOf { Route(.case(Self.index)) { Path { rootPath } Method.get } } } } }