# Route

A pipeable route value containing syntax, normalized path, and Effect Schemas.

## Signatures

```ts
export interface Route<P extends string, S extends Schema.Codec<any, Path.Params<P>, any, any> = Schema.Codec<Path.Params<P>>> extends Pipeable {
    readonly ast: AST.RouteAst;
    readonly path: P;
    readonly paramsSchema: S;
    readonly pathSchema: Schema.Codec<Path.PathParams<P>>;
    readonly querySchema: Schema.Codec<Path.QueryParams<P>>;
}
```

```ts
export declare namespace Route {
    type Any = Route<any, any>;
    type Path<T> = T extends Route<infer P, any> ? P : never;
    type Schema<T> = T extends Route<any, infer S> ? S : never;
    type Type<T> = T extends Route<any, infer S> ? S["Type"] : never;
    type Params<T> = T extends Route<infer P, infer _S> ? Path.Params<P> : never;
    type DecodingServices<T> = T extends Route<any, infer S> ? S["DecodingServices"] : never;
    type EncodingServices<T> = T extends Route<any, infer S> ? S["EncodingServices"] : never;
    type PathType<T extends Any> = T["pathSchema"]["Type"];
    type QueryType<T extends Any> = T["querySchema"]["Type"];
}
```

## Why

Matching and parameter decoding share one immutable source of truth.

## Ownership and lifetime

A Route value retains its AST and memoized derived values until that Route becomes unreachable; it owns no Scope.

## Property: ast

The immutable Route AST compiled by Matcher.

## Property: ast: Why

Advanced composition can inspect structure without reparsing the formatted path.

## Property: ast: Ownership and lifetime

The Route retains its `ast` value for the Route's lifetime. Reading it performs no acquisition; Codec services are required only when a schema is executed.

## Property: paramsSchema

The Effect Schema for the route's combined decoded parameters.

## Property: paramsSchema: Why

Matcher handlers receive the schema's Type and service/error behavior exactly.

## Property: paramsSchema: Ownership and lifetime

The Route retains its `paramsSchema` value for the Route's lifetime. Reading it performs no acquisition; Codec services are required only when a schema is executed.

## Property: path

The normalized route string derived from this Route's AST.

## Property: path: Why

Matcher registration and links use one memoized formatting result.

## Property: path: Ownership and lifetime

The Route retains its `path` value for the Route's lifetime. Reading it performs no acquisition; Codec services are required only when a schema is executed.

## Property: pathSchema

The Effect Schema for decoded path parameters only.

## Property: pathSchema: Why

Handlers and tools can validate path values independently of query input.

## Property: pathSchema: Ownership and lifetime

The Route retains its `pathSchema` value for the Route's lifetime. Reading it performs no acquisition; Codec services are required only when a schema is executed.

## Property: querySchema

The Effect Schema for decoded query parameters only.

## Property: querySchema: Why

Query parsing policy remains available separately from path decoding.

## Property: querySchema: Ownership and lifetime

The Route retains its `querySchema` value for the Route's lifetime. Reading it performs no acquisition; Codec services are required only when a schema is executed.
