# @oaknational/oak-curriculum-schema

Zod schemas and TypeScript types for Oak National Academy's curriculum data.

## Installation

```bash
pnpm add @oaknational/oak-curriculum-schema zod
```

## Usage

Every entity is available in both **snake_case** (matching database columns) and **camelCase** variants:

```ts
import {
    lessonSchema,
    lessonSchemaCamel,
    type Lesson,
    type LessonCamel,
} from "@oaknational/oak-curriculum-schema";

// Validate snake_case data (e.g. directly from the database)
const lesson = lessonSchema.parse(rawData);

// Validate snake_case data and transform to camelCase (e.g. when you want camelCase in your app)
const lessonCamel = lessonSchemaCamel.parse(apiResponse);
```

### Available schema categories

- **Public schemas** -- core curriculum entities (lessons, units, assets, questions, threads, unit variants)
- **Published schemas** -- contracts for materialized views and aggregated data shapes

### Non-conformant camelCase schemas

Most `*SchemaCamel` exports are derived via `zodToCamelCase`, which accepts **snake_case input** and transforms keys to camelCase during `.parse()`. The following schemas are exceptions -- they are manually defined with camelCase keys and therefore **expect camelCase input** directly. This will be fixed in a future major version.

- `contentGuidanceSchemaCamel`
- `keyLearningPointsSchemaCamel`
- `lessonOutlineSchemaCamel`
- `teacherTipsSchemaCamel`

## Links

- [npm package](https://www.npmjs.com/package/@oaknational/oak-curriculum-schema)
