openapi: 3.1.0
info:
  title: Edubridge API
  version: 1.0.0
  description: >
    # EduBridge API Overview


    The Edubridge API provides simplified interfaces for digital schools to
    manage their digital courses and student enrollments,

    abstracting away the complexities of the OneRoster standard while
    maintaining compatibility.


    It offers streamlined endpoints to enroll students in courses without the
    need to understand the underlying academic hierarchy.


    This API significantly reduces integration complexity for third-party
    systems by handling

    the background creation and management of academic sessions (per year),
    classes (per course), and enrollment relationships,

    allowing consumers to focus on educational experiences rather than data
    management.


    Entities involved in the Edubridge API:


    - Year academic session (per school)

    - Term academic session (spans the whole year)

    - Class (per course + term)

    - Enrollment (per student per class)


    ## Auto-managed entities


    The Edubridge API automatically manages the following entities:


    - Year academic session

    - Term academic session (spans the whole year)

    - Class (per course + term)


    ## Course-centric enrollment


    This API offers a course-centric view of enrollments, allowing consumers to
    focus on what courses the student is enrolled in rather than details about
    the underlying academic hierarchy.


    You as an API consumer do not need to understand the underlying academic
    hierarchy to use this API, if you are only interested in what courses a
    student is enrolled in.


    Consumers that need to interact with the underlying academic hierarchy
    through flows not covered by this API can do so by using the raw OneRoster
    API.


    ## Pre-requisites


    Before you can enroll a user in a course, you need the following entities
    created:


    - A school or equivalent organization

    - A course (linked to the organization via orgSourcedId)

    - A user (that will be enrolled in the course)


    ## Analytics API


    The Edubridge Analytics API provides student activity data and metrics
    across enrollments.


    ### Available Endpoints


    **Weekly Facts** - Get facts for a specific week by student email or ID

    - Returns: List of individual facts grouped by date


    **Activity (Date Range)** - Get facts for a custom date range by student
    email or ID

    - Returns: Aggregated metrics grouped by date → subject and date → subject →
    app


    **Enrollment Facts** - Get facts for a specific enrollment

    - Returns: Aggregated metrics for all activity within an enrollment

    - Supports optional date range filtering via `startDate` and `endDate` query
    parameters

    - Supports timezone conversion via `timezone` query parameter


    **Highest Grade Mastered** - Get the highest grade a student has mastered
    for a subject

    - Returns: Grade data from multiple sources (Edulastic, placement tests,
    test-out)


    **Student Percentiles** - Get the latest MAP percentile snapshots for a
    student

    - Returns: Per-subject percentile, RIT score, assessment date, and season

    - Used by: Goals UI setup and percentile/x-factor previews


    ### Metrics Included


    - **Activity Metrics**: Questions answered (total/correct), XP earned, units
    mastered

    - **Time Metrics**: Active seconds, inactive seconds, waste seconds

    - **Grouping**: Subject, application/platform, course, campus, date


    ### Authorization


    All analytics endpoints require the `analytics.readOnly` OAuth scope.


    ## Goals API


    The Goals API enables students to preview, track, and update learning goals
    through the Lambda-backed `/goals/*` surface.


    ### Goal Types


    | Type | Description | Required Fields |

    |------|-------------|-----------------|

    | `minimum` | Daily minimum XP target (ongoing) | `subject`, `targetValue`,
    `targetMetric` |

    | `grade_mastery` | Master content up to target grade | `subject`,
    `targetValue` |

    | `percentile` | Reach target percentile (RIT subjects only) | `subject`,
    `targetValue` |

    | `x_factor` | Grow Nx faster than typical (e.g., 2x growth) | `subject`,
    `targetValue` |

    | `course` | Complete a specific course or explicit course set | `subject`,
    `targetValue`, `targetMetric`, and either `stageId` or `courseIds` |


    ### Pace Type


    Milestone goals (`grade_mastery`, `percentile`, `x_factor`, `course`)
    support two pacing approaches:


    | paceType | User Sets | System Calculates |

    |----------|-----------|-------------------|

    | `target_date` | End date | Daily XP needed |

    | `daily_time` | Daily time commitment | Projected completion timeline |


    Example: "Reach 6th grade Math by May 15" (`target_date`) vs "Work toward
    6th grade Math at a steady daily pace" (`daily_time`).


    ### Available Endpoints


    **Subject Goals**

    - `GET /:studentId/subjects` - List subject goal snapshots for a student;
    bootstrap reads ensure managed minimum goals exist for currently enrolled
    supported subjects

    - `POST /:studentId/subjects` - Create the active learner-facing subject
    goal for a subject

    - `PATCH /:studentId/subjects/:subject` - Update the active learner-facing
    subject goal for a subject

    - `DELETE /:studentId/subjects/:subject` - Delete the active learner-facing
    subject goal for a subject

    - `PATCH /:studentId/subjects/:subject/minimum` - Update the managed minimum
    baseline for a subject

    - `POST /:studentId/subjects/preview` - Preview a learner-facing subject
    goal without saving it


    **Course Goals**

    - `GET /:studentId/courses` - List course goal snapshots for a student

    - `POST /:studentId/courses` - Create an atomic course goal

    - `PATCH /:studentId/courses/:goalId` - Update an atomic course goal

    - `DELETE /:studentId/courses/:goalId` - Delete an atomic course goal

    - `POST /:studentId/courses/preview` - Preview an atomic course goal without
    saving it


    ### Response Notes


    - Subject list responses return `{ studentId, subjects: [...] }`.

    - Subject create/update/minimum-patch responses return `{ subject: ... }`.

    - Subject preview responses return `{ preview: ... }`.

    - Course list responses return `{ studentId, courses: [...] }`.

    - Course create/update responses return `{ course: ... }`.

    - Course preview responses return `{ preview: ... }`.
      - `progress.resolution`
    - Preview responses return `{ preview: { goal: ... } }` using the same inner
    goal shape as saved goal detail.

    - Minimum goals are internally managed baseline rows:
      - auto-created for supported enrolled subjects on the canonical bootstrap goals-list read
      - readable and patchable
      - not creatable or deletable by clients
    - Filtered/history list reads are pure reads and do not run minimum-goal
    sync.

    - Standalone pace and NWEA helper endpoints are intentionally not part of
    the public goals surface.


    ### Supported Subjects


    RIT subjects (for percentile and x-factor goals): Math, Reading, Language,
    Science


    All subjects: Math, Reading, Language, Vocabulary, Science, Writing,
    FastMath, Social Studies


    ### Authorization


    All goals endpoints require authentication. Endpoints that rely on upstream
    analytics or sequence resolution also require the same auth context/API
    Gateway flow used by the Lambda-backed goals service.


    ## Student Progress API


    These Lambda-backed endpoints expose non-goal progress projections outside
    the goals namespace.


    ### Available Endpoints


    - `GET /students/:studentId/courses/:courseId/progress` - Get progress for a
    single course

    - `GET /students/:studentId/subjects/:subject/grades/:grade/progress` - Get
    aggregate progress for all courses in a subject-grade band


    ### Authorization


    Student progress endpoints require the same authenticated Lambda-backed flow
    used by the goals service.


    ## AP Readiness API


    The AP Readiness API provides a specialized workflow for AP exam
    preparation. It stores AP readiness goals in `learning_goals` using the
    `ap_readiness` goal type, but it has its own API surface, scoring pipeline,
    dashboard, and drill-down views.


    ### Available Endpoints


    **Reference Data**

    - `GET /subjects` - List supported AP exam subjects and title-matching
    patterns


    **Dashboard & Drill-down**

    - `GET /dashboard?subject=...` - Get dashboard rows for all active AP
    readiness goals in one AP subject

    - `GET /students/:studentId/drill-down?goalId=...` - Get per-unit drill-down
    data for one student's AP goal


    **Goal Management**

    - `GET /goals?subject=...` - List active AP readiness goals for an AP
    subject

    - `POST /goals` - Create an AP readiness goal

    - `PATCH /goals/:goalId` - Update the tracked courses or exam date for an AP
    readiness goal


    **Enrollment Validation**

    - `GET /enrollment-check?studentId=...&courseIds=id1,id2,...` - Return
    courses where the student has no active enrollment


    ### Goal Model


    - `goalType` is always `ap_readiness`

    - `targetMetric` is always `percent`

    - `paceType` is always `target_date`

    - `targetValue` is currently fixed to the readiness threshold for a
    predicted AP score of `5`

    - `courseIds` stores all tracked courses

    - `metadata.practice_test_course_ids` stores the subset of tracked courses
    that are practice tests

    - `curriculumCourseIds` is a derived field returned by the API and equals
    `courseIds - practice_test_course_ids`


    ### Dashboard Metrics


    Each dashboard row includes:


    - `readiness.componentA` - curriculum course progress percentage from XP

    - `readiness.componentB` - weighted practice-test accuracy percentage

    - `readiness.componentC` - final readiness percentage

    - `readiness.predictedScore` - predicted AP score from `1-5`

    - `coverage` - how many curriculum units have assessed activity

    - `topFocusAreas` - weakest unit names

    - `timeRemainingPct` - percent of time remaining until the exam date


    ### Response Notes


    - Create and update responses return `{ goal: ... }`

    - List responses return `{ goals: [...], totalCount }`

    - Dashboard responses return `{ rows: [...] }`

    - Drill-down responses return `{ units: [...] }`

    - Enrollment-check responses return `{ missingEnrollments: [...] }`


    ### Authorization


    AP Readiness endpoints require authentication and the same API Gateway auth
    context used by the Lambda-backed service.
servers:
  - url: https://api.alpha-1edtech.ai
    description: Edubridge API
tags:
  - name: Analytics
    description: >-
      Analytics endpoints for retrieving and aggregating student activity data,
      including weekly facts and activity reports across date ranges.
  - name: AP Readiness
    description: >-
      AP exam readiness endpoints for creating AP readiness goals, viewing
      dashboard metrics, drilling into weak units, and checking enrollment gaps
      for AP preparation courses.
  - name: Application Metrics
    description: Track and manage application metrics for monitoring and analytics purposes
  - name: Applications
    description: >-
      Manage and retrieve applications available in the system. Applications
      represent different learning platforms or educational software that can be
      integrated.
  - name: Enrollments
    description: >-
      Simplified, course-centric enrollment management that abstracts away the
      complex OneRoster academic hierarchy
  - name: Goals
    description: >-
      Learning goal management endpoints for setting, tracking, and projecting
      learning goals including daily minimums, grade mastery targets, percentile
      targets, and course completion goals.
  - name: Learning Reports
    description: >-
      Learning reports endpoints for retrieving and aggregating student activity
      data, including weekly facts and activity reports.
  - name: Progression
    description: >-
      Proxy endpoints for the student progression pipeline. These routes forward
      requests to Lambda-backed API Gateway endpoints that handle Caliper event
      ingestion, progression enqueuing, and hole-filling course creation.
  - name: Subject Track
    description: >-
      Subject tracks determine the target course for each subject and grade
      level. For example, for subject 'Math' grade level '9', the target course
      can be 'Math Academy 9th Grade' (this is the course that students will be
      enrolled in when they get placed to Math Grade 9). There can be only one
      target course per subject and grade level.
  - name: Users
    description: >-
      User management endpoints that provide simplified access to user data with
      enhanced filtering and querying capabilities beyond the standard OneRoster
      API.
security:
  - OAuth2: []
paths:
  /ap-readiness/dashboard:
    get:
      operationId: getApReadinessDashboard
      summary: Get AP readiness dashboard rows for a subject
      description: >-
        Returns all active AP readiness goals for the requested AP subject with
        readiness, coverage, focus-area, and time-remaining metrics.
      tags:
        - AP Readiness
      parameters:
        - in: query
          name: subject
          description: AP exam name to filter dashboard by
          schema:
            type: string
            enum: &ref_0
              - AP Biology
              - AP Calculus AB
              - AP Calculus BC
              - AP Chemistry
              - AP Computer Science A
              - AP Computer Science Principles
              - AP English Language and Composition
              - AP English Literature and Composition
              - AP Environmental Science
              - AP Human Geography
              - AP Microeconomics
              - AP Music Theory
              - 'AP Physics 1: Algebra-Based'
              - 'AP Physics 2: Algebra-Based'
              - AP Psychology
              - AP Statistics
              - AP US History
              - AP United States Government and Politics
              - 'AP World History: Modern'
            description: AP exam name to filter dashboard by
          required: true
      responses:
        '200':
          description: Dashboard rows returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  rows:
                    type: array
                    items:
                      type: object
                      properties:
                        goalId:
                          type: string
                          description: AP readiness goal sourcedId
                        studentSourcedId:
                          type: string
                          description: Student sourcedId
                        studentName:
                          type: string
                          description: Student display name
                        subject:
                          type: string
                          enum: &ref_1
                            - AP Biology
                            - AP Calculus AB
                            - AP Calculus BC
                            - AP Chemistry
                            - AP Computer Science A
                            - AP Computer Science Principles
                            - AP English Language and Composition
                            - AP English Literature and Composition
                            - AP Environmental Science
                            - AP Human Geography
                            - AP Microeconomics
                            - AP Music Theory
                            - 'AP Physics 1: Algebra-Based'
                            - 'AP Physics 2: Algebra-Based'
                            - AP Psychology
                            - AP Statistics
                            - AP US History
                            - AP United States Government and Politics
                            - 'AP World History: Modern'
                          description: AP exam subject
                        readiness:
                          type: object
                          properties:
                            componentA:
                              type:
                                - number
                                - 'null'
                              description: >-
                                Course XP progress percentage (0-100), or null
                                when unavailable
                            componentB:
                              type:
                                - number
                                - 'null'
                              description: >-
                                Weighted practice test accuracy percentage
                                (0-100), or null when unavailable
                            componentC:
                              type: number
                              description: Final readiness percentage (0-100)
                            hasPracticeTestData:
                              type: boolean
                              description: >-
                                Whether the readiness score includes practice
                                test data
                            predictedScore:
                              anyOf:
                                - type: number
                                  const: 1
                                - type: number
                                  const: 2
                                - type: number
                                  const: 3
                                - type: number
                                  const: 4
                                - type: number
                                  const: 5
                              description: Predicted AP exam score
                            predictedScoreLabel:
                              type: string
                              description: College Board score label
                          required:
                            - componentA
                            - componentB
                            - componentC
                            - hasPracticeTestData
                            - predictedScore
                            - predictedScoreLabel
                          description: Computed readiness metrics
                        coverage:
                          type: object
                          properties:
                            assessed:
                              type: integer
                              description: >-
                                Number of curriculum units with assessed
                                activity
                            total:
                              type: integer
                              description: >-
                                Total active curriculum units across tracked
                                courses
                            percentage:
                              type: number
                              description: Coverage percentage from 0 to 100
                          required:
                            - assessed
                            - total
                            - percentage
                          description: Coverage of assessed units
                        topFocusAreas:
                          type: array
                          items:
                            type: string
                          description: >-
                            Weakest unit names, sorted from highest priority to
                            lower priority
                        timeRemainingPct:
                          type: number
                          description: >-
                            Percent of time remaining between startDate and
                            endDate
                        goalStatus:
                          type: string
                          enum:
                            - active
                            - completed
                            - cancelled
                          description: Goal completion status
                        startDate:
                          type: string
                          description: Start date (YYYY-MM-DD)
                        endDate:
                          type: string
                          description: Exam date / target end date (YYYY-MM-DD)
                      required:
                        - goalId
                        - studentSourcedId
                        - studentName
                        - subject
                        - readiness
                        - coverage
                        - topFocusAreas
                        - timeRemainingPct
                        - goalStatus
                        - startDate
                        - endDate
                required:
                  - rows
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /ap-readiness/enrollment-check:
    get:
      operationId: checkApReadinessEnrollments
      summary: Check missing enrollments for AP readiness courses
      description: >-
        Returns the subset of requested courses where the student does not have
        an active enrollment.
      tags:
        - AP Readiness
      parameters:
        - in: query
          name: studentId
          schema:
            type: string
            minLength: 1
          required: true
        - in: query
          name: courseIds
          description: Comma-separated list of course IDs to check enrollment for
          schema:
            type: string
            minLength: 1
            description: Comma-separated list of course IDs to check enrollment for
          required: true
      responses:
        '200':
          description: Missing enrollments returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  missingEnrollments:
                    type: array
                    items:
                      type: object
                      properties:
                        courseId:
                          type: string
                          description: Course sourcedId with no active enrollment
                        courseTitle:
                          type: string
                          description: Course title
                      required:
                        - courseId
                        - courseTitle
                required:
                  - missingEnrollments
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /ap-readiness/goals:
    get:
      operationId: listApReadinessGoals
      summary: List active AP readiness goals for a subject
      description: >-
        Returns all active AP readiness goals for the requested AP subject. This
        is the lightweight goal list view without computed dashboard metrics.
      tags:
        - AP Readiness
      parameters:
        - in: query
          name: subject
          description: AP exam name to filter dashboard by
          schema:
            type: string
            enum: *ref_0
            description: AP exam name to filter dashboard by
          required: true
      responses:
        '200':
          description: AP readiness goals returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  goals:
                    type: array
                    items:
                      type: object
                      properties:
                        sourcedId:
                          type: string
                          description: Goal sourcedId
                        status:
                          type: string
                          enum: &ref_2
                            - active
                            - tobedeleted
                          description: OneRoster lifecycle status
                        dateLastModified:
                          type: string
                          description: Last modification timestamp
                        studentSourcedId:
                          type: string
                          description: Student sourcedId
                        subject:
                          type: string
                          enum: *ref_1
                          description: AP exam subject
                        goalType:
                          type: string
                          const: ap_readiness
                          description: AP readiness goal type
                        targetValue:
                          type: string
                          description: >-
                            Target readiness percentage stored in the goal,
                            currently 90
                        targetMetric:
                          type: string
                          const: percent
                          description: AP readiness goals always use percent
                        paceType:
                          type: string
                          const: target_date
                          description: AP readiness goals are always target-date paced
                        startDate:
                          type: string
                          description: Start date of the tracking period (YYYY-MM-DD)
                        endDate:
                          type: string
                          description: Exam date / target end date (YYYY-MM-DD)
                        goalStatus:
                          type: string
                          enum: &ref_3
                            - active
                            - completed
                            - cancelled
                          description: Goal completion status
                        goalCreatedAt:
                          type: string
                          description: Goal creation timestamp
                        courseIds:
                          type: array
                          items:
                            type: string
                          description: All tracked course IDs, including practice tests
                        metadata:
                          type: object
                          properties:
                            practice_test_course_ids:
                              type: array
                              items:
                                type: string
                              description: >-
                                Subset of courseIds that are considered practice
                                test courses
                          required:
                            - practice_test_course_ids
                          description: AP readiness metadata
                        curriculumCourseIds:
                          type: array
                          items:
                            type: string
                          description: >-
                            Derived curriculum course IDs after removing
                            practice test courses
                      required:
                        - sourcedId
                        - status
                        - dateLastModified
                        - studentSourcedId
                        - subject
                        - goalType
                        - targetValue
                        - targetMetric
                        - paceType
                        - startDate
                        - endDate
                        - goalStatus
                        - goalCreatedAt
                        - courseIds
                        - metadata
                        - curriculumCourseIds
                  totalCount:
                    type: integer
                    minimum: 0
                    description: Total number of matching AP goals
                required:
                  - goals
                  - totalCount
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
    post:
      operationId: createApReadinessGoal
      summary: Create an AP readiness goal
      description: >-
        Creates an AP readiness goal for a student. Only one active AP readiness
        goal is allowed per student and AP subject; creating a new one cancels
        the previous active goal for that student and subject.
      tags:
        - AP Readiness
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                studentSourcedId:
                  type: string
                  minLength: 1
                subject:
                  type: string
                  enum: *ref_0
                  description: Must be one of the 19 official College Board AP exam names
                courseIds:
                  type: array
                  items:
                    type: string
                    minLength: 1
                  minItems: 1
                  description: All curriculum course IDs for this AP goal
                practiceTestCourseIds:
                  type: array
                  items:
                    type: string
                    minLength: 1
                  default: []
                  description: >-
                    Subset of courseIds that are practice test courses. Can be
                    empty at creation.
                startDate:
                  type: string
                  pattern: ^\d{4}-\d{2}-\d{2}$
                  description: Start date of tracking period (ISO date)
                endDate:
                  type: string
                  pattern: ^\d{4}-\d{2}-\d{2}$
                  description: AP exam date (ISO date)
              required:
                - studentSourcedId
                - subject
                - courseIds
                - startDate
                - endDate
      responses:
        '201':
          description: AP readiness goal created
          content:
            application/json:
              schema:
                type: object
                properties:
                  goal:
                    type: object
                    properties:
                      sourcedId:
                        type: string
                        description: Goal sourcedId
                      status:
                        type: string
                        enum: *ref_2
                        description: OneRoster lifecycle status
                      dateLastModified:
                        type: string
                        description: Last modification timestamp
                      studentSourcedId:
                        type: string
                        description: Student sourcedId
                      subject:
                        type: string
                        enum: *ref_1
                        description: AP exam subject
                      goalType:
                        type: string
                        const: ap_readiness
                        description: AP readiness goal type
                      targetValue:
                        type: string
                        description: >-
                          Target readiness percentage stored in the goal,
                          currently 90
                      targetMetric:
                        type: string
                        const: percent
                        description: AP readiness goals always use percent
                      paceType:
                        type: string
                        const: target_date
                        description: AP readiness goals are always target-date paced
                      startDate:
                        type: string
                        description: Start date of the tracking period (YYYY-MM-DD)
                      endDate:
                        type: string
                        description: Exam date / target end date (YYYY-MM-DD)
                      goalStatus:
                        type: string
                        enum: *ref_3
                        description: Goal completion status
                      goalCreatedAt:
                        type: string
                        description: Goal creation timestamp
                      courseIds:
                        type: array
                        items:
                          type: string
                        description: All tracked course IDs, including practice tests
                      metadata:
                        type: object
                        properties:
                          practice_test_course_ids:
                            type: array
                            items:
                              type: string
                            description: >-
                              Subset of courseIds that are considered practice
                              test courses
                        required:
                          - practice_test_course_ids
                        description: AP readiness metadata
                      curriculumCourseIds:
                        type: array
                        items:
                          type: string
                        description: >-
                          Derived curriculum course IDs after removing practice
                          test courses
                    required:
                      - sourcedId
                      - status
                      - dateLastModified
                      - studentSourcedId
                      - subject
                      - goalType
                      - targetValue
                      - targetMetric
                      - paceType
                      - startDate
                      - endDate
                      - goalStatus
                      - goalCreatedAt
                      - courseIds
                      - metadata
                      - curriculumCourseIds
                required:
                  - goal
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /ap-readiness/goals/{goalId}:
    patch:
      operationId: updateApReadinessGoal
      summary: Update an AP readiness goal
      description: >-
        Partially updates the tracked course set and/or exam date for an AP
        readiness goal.
      tags:
        - AP Readiness
      parameters:
        - name: goalId
          description: AP readiness goal sourcedId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                courseIds:
                  type: array
                  items:
                    type: string
                    minLength: 1
                  minItems: 1
                  description: Replace full list of curriculum course IDs
                practiceTestCourseIds:
                  type: array
                  items:
                    type: string
                    minLength: 1
                  description: Replace full list of practice test course IDs
                endDate:
                  type: string
                  pattern: ^\d{4}-\d{2}-\d{2}$
                  description: Update AP exam date
      responses:
        '200':
          description: AP readiness goal updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  goal:
                    type: object
                    properties:
                      sourcedId:
                        type: string
                        description: Goal sourcedId
                      status:
                        type: string
                        enum: *ref_2
                        description: OneRoster lifecycle status
                      dateLastModified:
                        type: string
                        description: Last modification timestamp
                      studentSourcedId:
                        type: string
                        description: Student sourcedId
                      subject:
                        type: string
                        enum: *ref_1
                        description: AP exam subject
                      goalType:
                        type: string
                        const: ap_readiness
                        description: AP readiness goal type
                      targetValue:
                        type: string
                        description: >-
                          Target readiness percentage stored in the goal,
                          currently 90
                      targetMetric:
                        type: string
                        const: percent
                        description: AP readiness goals always use percent
                      paceType:
                        type: string
                        const: target_date
                        description: AP readiness goals are always target-date paced
                      startDate:
                        type: string
                        description: Start date of the tracking period (YYYY-MM-DD)
                      endDate:
                        type: string
                        description: Exam date / target end date (YYYY-MM-DD)
                      goalStatus:
                        type: string
                        enum: *ref_3
                        description: Goal completion status
                      goalCreatedAt:
                        type: string
                        description: Goal creation timestamp
                      courseIds:
                        type: array
                        items:
                          type: string
                        description: All tracked course IDs, including practice tests
                      metadata:
                        type: object
                        properties:
                          practice_test_course_ids:
                            type: array
                            items:
                              type: string
                            description: >-
                              Subset of courseIds that are considered practice
                              test courses
                        required:
                          - practice_test_course_ids
                        description: AP readiness metadata
                      curriculumCourseIds:
                        type: array
                        items:
                          type: string
                        description: >-
                          Derived curriculum course IDs after removing practice
                          test courses
                    required:
                      - sourcedId
                      - status
                      - dateLastModified
                      - studentSourcedId
                      - subject
                      - goalType
                      - targetValue
                      - targetMetric
                      - paceType
                      - startDate
                      - endDate
                      - goalStatus
                      - goalCreatedAt
                      - courseIds
                      - metadata
                      - curriculumCourseIds
                required:
                  - goal
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /ap-readiness/students/{studentId}/drill-down:
    get:
      operationId: getApReadinessDrillDown
      summary: Get AP readiness drill-down for a student goal
      description: >-
        Returns the per-unit accuracy breakdown for a student's AP readiness
        goal. The goalId query parameter must belong to the same student.
      tags:
        - AP Readiness
      parameters:
        - name: studentId
          description: Student sourcedId
          in: path
          required: true
          schema:
            type: string
        - in: query
          name: goalId
          schema:
            type: string
            minLength: 1
          required: true
      responses:
        '200':
          description: Drill-down units returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  units:
                    type: array
                    items:
                      type: object
                      properties:
                        unitId:
                          type: string
                          description: Course component sourcedId for the top-level unit
                        unitName:
                          type: string
                          description: Unit title
                        courseId:
                          type: string
                          description: Course sourcedId the unit belongs to
                        overallAccuracyPct:
                          type:
                            - number
                            - 'null'
                          description: >-
                            Overall unit accuracy from processed facts, or null
                            when unavailable
                        mcqAccuracyPct:
                          type:
                            - number
                            - 'null'
                          description: >-
                            Multiple-choice accuracy percentage, or null when
                            unavailable
                        frqAccuracyPct:
                          type:
                            - number
                            - 'null'
                          description: >-
                            Free-response accuracy percentage, or null when
                            unavailable
                        totalQuestions:
                          type: integer
                          description: Total questions answered in this unit
                        correctQuestions:
                          type: integer
                          description: Total correct questions in this unit
                        isLowData:
                          type: boolean
                          description: >-
                            Whether the unit has fewer than the low-data
                            threshold
                      required:
                        - unitId
                        - unitName
                        - courseId
                        - overallAccuracyPct
                        - mcqAccuracyPct
                        - frqAccuracyPct
                        - totalQuestions
                        - correctQuestions
                        - isLowData
                required:
                  - units
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /ap-readiness/subjects:
    get:
      operationId: listApReadinessSubjects
      summary: List supported AP exam subjects
      description: >-
        Returns the supported AP exam subjects and the title-matching patterns
        used to suggest candidate courses.
      tags:
        - AP Readiness
      responses:
        '200':
          description: AP subjects returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  subjects:
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                          enum: *ref_1
                          description: Official College Board AP exam subject name
                        titlePatterns:
                          type: array
                          items:
                            type: string
                          description: >-
                            ILIKE title patterns used to match candidate courses
                            for this AP exam
                      required:
                        - name
                        - titlePatterns
                required:
                  - subjects
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /goals/{studentId}/courses:
    get:
      operationId: listGoalCourses
      summary: List course goal snapshots for a student
      description: >-
        Primary 9-12 goals read model. Returns one row per enrolled course with
        the current active atomic course goal, if any, plus the course progress
        snapshot used to evaluate it.
      tags:
        - Goals
      parameters:
        - name: studentId
          description: Student sourcedId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Course goal snapshots returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  studentId:
                    type: string
                    description: Student sourcedId
                  courses:
                    type: array
                    items:
                      type: object
                      properties:
                        course:
                          type: object
                          properties:
                            id:
                              type: string
                              description: Course identifier
                            title:
                              type: string
                              description: Course title
                            subject:
                              type:
                                - string
                                - 'null'
                              description: Primary subject label derived for the course
                          required:
                            - id
                            - title
                            - subject
                        goal:
                          type:
                            - object
                            - 'null'
                          properties:
                            id:
                              type: string
                              description: Active course goal identifier
                            status:
                              type: string
                              enum: &ref_5
                                - active
                                - completed
                                - cancelled
                              description: Business status for the saved course goal
                            target:
                              type: object
                              properties:
                                metric:
                                  type: string
                                  enum: &ref_4
                                    - xp
                                    - lessons
                                    - units
                                    - percent
                                  description: Atomic course goal target metric
                                value:
                                  type: string
                                  description: Atomic course goal target value
                              required:
                                - metric
                                - value
                            pacing:
                              type: object
                              properties:
                                mode:
                                  type:
                                    - string
                                    - 'null'
                                  enum:
                                    - target_date
                                    - daily_time
                                    - null
                                  description: Course-goal pacing mode
                                endDate:
                                  type:
                                    - string
                                    - 'null'
                                  description: >-
                                    Optional target end date in YYYY-MM-DD
                                    format
                              required:
                                - mode
                                - endDate
                          required:
                            - id
                            - status
                            - target
                            - pacing
                          description: >-
                            Newest active course goal for the enrolled course,
                            if one exists
                        progress:
                          type: object
                          properties:
                            courseId:
                              type: string
                              description: The sourcedId of the course
                            courseTitle:
                              type: string
                              description: The title of the course
                            pctComplete:
                              type: number
                              description: Overall percentage complete (0-1)
                            pctCompleteApp:
                              type:
                                - number
                                - 'null'
                              description: Percentage complete from app tracking
                            pctCompleteLessons:
                              type:
                                - number
                                - 'null'
                              description: Percentage of lessons completed
                            pctCompleteXP:
                              type:
                                - number
                                - 'null'
                              description: Percentage of XP earned
                            totalXP:
                              type: number
                              description: Total XP available in the course
                            earnedXP:
                              type: number
                              description: XP earned by the student
                            remainingXP:
                              type: number
                              description: Remaining XP to earn
                            totalUnits:
                              type: number
                              description: Total units (components) in the course
                            completedUnits:
                              type: number
                              description: Number of completed units
                            remainingUnits:
                              type: number
                              description: Number of remaining units
                            totalLessons:
                              type: number
                              description: Total lessons in the course
                            completedLessons:
                              type: number
                              description: Number of completed lessons
                            remainingLessons:
                              type: number
                              description: Number of remaining lessons
                          required:
                            - courseId
                            - courseTitle
                            - pctComplete
                            - pctCompleteApp
                            - pctCompleteLessons
                            - pctCompleteXP
                            - totalXP
                            - earnedXP
                            - remainingXP
                            - totalUnits
                            - completedUnits
                            - remainingUnits
                            - totalLessons
                            - completedLessons
                            - remainingLessons
                      required:
                        - course
                        - goal
                        - progress
                required:
                  - studentId
                  - courses
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
    post:
      operationId: createCourseGoalProduct
      summary: Create an atomic course goal
      description: >-
        Creates a 9-12 course-scoped atomic goal for a currently enrolled
        course. Subject metadata is derived from the course rather than supplied
        as canonical input.
      tags:
        - Goals
      parameters:
        - name: studentId
          description: Student sourcedId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                courseId:
                  type: string
                  description: Tracked enrolled course identifier
                target:
                  type: object
                  properties:
                    metric:
                      type: string
                      enum: *ref_4
                      description: Atomic course goal target metric
                    value:
                      type: string
                      description: Atomic course goal target value
                  required:
                    - metric
                    - value
                pacing:
                  type: object
                  properties:
                    mode:
                      type:
                        - string
                        - 'null'
                      enum:
                        - target_date
                        - daily_time
                        - null
                      description: >-
                        How the goal was set: target_date (user set end date) or
                        daily_time (user set daily commitment)
                    endDate:
                      type:
                        - string
                        - 'null'
              required:
                - courseId
                - target
      responses:
        '201':
          description: Course goal created
          content:
            application/json:
              schema:
                type: object
                properties:
                  course:
                    type: object
                    properties:
                      course:
                        type: object
                        properties:
                          id:
                            type: string
                            description: Course identifier
                          title:
                            type: string
                            description: Course title
                          subject:
                            type:
                              - string
                              - 'null'
                            description: Primary subject label derived for the course
                        required:
                          - id
                          - title
                          - subject
                      goal:
                        type:
                          - object
                          - 'null'
                        properties:
                          id:
                            type: string
                            description: Active course goal identifier
                          status:
                            type: string
                            enum: *ref_5
                            description: Business status for the saved course goal
                          target:
                            type: object
                            properties:
                              metric:
                                type: string
                                enum: *ref_4
                                description: Atomic course goal target metric
                              value:
                                type: string
                                description: Atomic course goal target value
                            required:
                              - metric
                              - value
                          pacing:
                            type: object
                            properties:
                              mode:
                                type:
                                  - string
                                  - 'null'
                                enum:
                                  - target_date
                                  - daily_time
                                  - null
                                description: Course-goal pacing mode
                              endDate:
                                type:
                                  - string
                                  - 'null'
                                description: Optional target end date in YYYY-MM-DD format
                            required:
                              - mode
                              - endDate
                        required:
                          - id
                          - status
                          - target
                          - pacing
                        description: >-
                          Newest active course goal for the enrolled course, if
                          one exists
                      progress:
                        type: object
                        properties:
                          courseId:
                            type: string
                            description: The sourcedId of the course
                          courseTitle:
                            type: string
                            description: The title of the course
                          pctComplete:
                            type: number
                            description: Overall percentage complete (0-1)
                          pctCompleteApp:
                            type:
                              - number
                              - 'null'
                            description: Percentage complete from app tracking
                          pctCompleteLessons:
                            type:
                              - number
                              - 'null'
                            description: Percentage of lessons completed
                          pctCompleteXP:
                            type:
                              - number
                              - 'null'
                            description: Percentage of XP earned
                          totalXP:
                            type: number
                            description: Total XP available in the course
                          earnedXP:
                            type: number
                            description: XP earned by the student
                          remainingXP:
                            type: number
                            description: Remaining XP to earn
                          totalUnits:
                            type: number
                            description: Total units (components) in the course
                          completedUnits:
                            type: number
                            description: Number of completed units
                          remainingUnits:
                            type: number
                            description: Number of remaining units
                          totalLessons:
                            type: number
                            description: Total lessons in the course
                          completedLessons:
                            type: number
                            description: Number of completed lessons
                          remainingLessons:
                            type: number
                            description: Number of remaining lessons
                        required:
                          - courseId
                          - courseTitle
                          - pctComplete
                          - pctCompleteApp
                          - pctCompleteLessons
                          - pctCompleteXP
                          - totalXP
                          - earnedXP
                          - remainingXP
                          - totalUnits
                          - completedUnits
                          - remainingUnits
                          - totalLessons
                          - completedLessons
                          - remainingLessons
                    required:
                      - course
                      - goal
                      - progress
                required:
                  - course
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /goals/{studentId}/courses/{goalId}:
    patch:
      operationId: updateCourseGoalProduct
      summary: Update an atomic course goal
      description: >-
        Updates an atomic course-scoped goal without forcing course clients
        through subject-oriented payloads.
      tags:
        - Goals
      parameters:
        - name: studentId
          description: Student sourcedId
          in: path
          required: true
          schema:
            type: string
        - name: goalId
          description: Course goal identifier
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                target:
                  type: object
                  properties:
                    metric:
                      type: string
                      enum: *ref_4
                      description: Atomic course goal target metric
                    value:
                      type: string
                      description: Atomic course goal target value
                  required:
                    - metric
                    - value
                pacing:
                  type: object
                  properties:
                    mode:
                      type:
                        - string
                        - 'null'
                      enum:
                        - target_date
                        - daily_time
                        - null
                      description: >-
                        How the goal was set: target_date (user set end date) or
                        daily_time (user set daily commitment)
                    endDate:
                      type:
                        - string
                        - 'null'
      responses:
        '200':
          description: Course goal updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  course:
                    type: object
                    properties:
                      course:
                        type: object
                        properties:
                          id:
                            type: string
                            description: Course identifier
                          title:
                            type: string
                            description: Course title
                          subject:
                            type:
                              - string
                              - 'null'
                            description: Primary subject label derived for the course
                        required:
                          - id
                          - title
                          - subject
                      goal:
                        type:
                          - object
                          - 'null'
                        properties:
                          id:
                            type: string
                            description: Active course goal identifier
                          status:
                            type: string
                            enum: *ref_5
                            description: Business status for the saved course goal
                          target:
                            type: object
                            properties:
                              metric:
                                type: string
                                enum: *ref_4
                                description: Atomic course goal target metric
                              value:
                                type: string
                                description: Atomic course goal target value
                            required:
                              - metric
                              - value
                          pacing:
                            type: object
                            properties:
                              mode:
                                type:
                                  - string
                                  - 'null'
                                enum:
                                  - target_date
                                  - daily_time
                                  - null
                                description: Course-goal pacing mode
                              endDate:
                                type:
                                  - string
                                  - 'null'
                                description: Optional target end date in YYYY-MM-DD format
                            required:
                              - mode
                              - endDate
                        required:
                          - id
                          - status
                          - target
                          - pacing
                        description: >-
                          Newest active course goal for the enrolled course, if
                          one exists
                      progress:
                        type: object
                        properties:
                          courseId:
                            type: string
                            description: The sourcedId of the course
                          courseTitle:
                            type: string
                            description: The title of the course
                          pctComplete:
                            type: number
                            description: Overall percentage complete (0-1)
                          pctCompleteApp:
                            type:
                              - number
                              - 'null'
                            description: Percentage complete from app tracking
                          pctCompleteLessons:
                            type:
                              - number
                              - 'null'
                            description: Percentage of lessons completed
                          pctCompleteXP:
                            type:
                              - number
                              - 'null'
                            description: Percentage of XP earned
                          totalXP:
                            type: number
                            description: Total XP available in the course
                          earnedXP:
                            type: number
                            description: XP earned by the student
                          remainingXP:
                            type: number
                            description: Remaining XP to earn
                          totalUnits:
                            type: number
                            description: Total units (components) in the course
                          completedUnits:
                            type: number
                            description: Number of completed units
                          remainingUnits:
                            type: number
                            description: Number of remaining units
                          totalLessons:
                            type: number
                            description: Total lessons in the course
                          completedLessons:
                            type: number
                            description: Number of completed lessons
                          remainingLessons:
                            type: number
                            description: Number of remaining lessons
                        required:
                          - courseId
                          - courseTitle
                          - pctComplete
                          - pctCompleteApp
                          - pctCompleteLessons
                          - pctCompleteXP
                          - totalXP
                          - earnedXP
                          - remainingXP
                          - totalUnits
                          - completedUnits
                          - remainingUnits
                          - totalLessons
                          - completedLessons
                          - remainingLessons
                    required:
                      - course
                      - goal
                      - progress
                required:
                  - course
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
    delete:
      operationId: deleteCourseGoalProduct
      summary: Delete an atomic course goal
      description: Deletes the active atomic course goal.
      tags:
        - Goals
      parameters:
        - name: studentId
          description: Student sourcedId
          in: path
          required: true
          schema:
            type: string
        - name: goalId
          description: Course goal identifier
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: Course goal deleted
          content: {}
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /goals/{studentId}/courses/preview:
    post:
      operationId: previewCourseGoalProduct
      summary: Preview an atomic course goal
      description: >-
        Returns the product-shaped course goal preview without creating or
        updating a row.
      tags:
        - Goals
      parameters:
        - name: studentId
          description: Student sourcedId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                courseId:
                  type: string
                  description: Tracked enrolled course identifier
                target:
                  type: object
                  properties:
                    metric:
                      type: string
                      enum: *ref_4
                      description: Atomic course goal target metric
                    value:
                      type: string
                      description: Atomic course goal target value
                  required:
                    - metric
                    - value
                pacing:
                  type: object
                  properties:
                    mode:
                      type:
                        - string
                        - 'null'
                      enum:
                        - target_date
                        - daily_time
                        - null
                      description: >-
                        How the goal was set: target_date (user set end date) or
                        daily_time (user set daily commitment)
                    endDate:
                      type:
                        - string
                        - 'null'
              required:
                - courseId
                - target
      responses:
        '200':
          description: Course preview returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  preview:
                    type: object
                    properties:
                      course:
                        type: object
                        properties:
                          id:
                            type: string
                            description: Course identifier
                          title:
                            type: string
                            description: Course title
                          subject:
                            type:
                              - string
                              - 'null'
                            description: Primary subject label derived for the course
                        required:
                          - id
                          - title
                          - subject
                      goal:
                        type: object
                        properties:
                          target:
                            type: object
                            properties:
                              metric:
                                type: string
                                enum: *ref_4
                                description: Atomic course goal target metric
                              value:
                                type: string
                                description: Atomic course goal target value
                            required:
                              - metric
                              - value
                          pacing:
                            type: object
                            properties:
                              mode:
                                type:
                                  - string
                                  - 'null'
                                enum:
                                  - target_date
                                  - daily_time
                                  - null
                                description: Course-goal pacing mode
                              endDate:
                                type:
                                  - string
                                  - 'null'
                                description: Optional target end date in YYYY-MM-DD format
                            required:
                              - mode
                              - endDate
                        required:
                          - target
                          - pacing
                      progress:
                        type: object
                        properties:
                          courseId:
                            type: string
                            description: The sourcedId of the course
                          courseTitle:
                            type: string
                            description: The title of the course
                          pctComplete:
                            type: number
                            description: Overall percentage complete (0-1)
                          pctCompleteApp:
                            type:
                              - number
                              - 'null'
                            description: Percentage complete from app tracking
                          pctCompleteLessons:
                            type:
                              - number
                              - 'null'
                            description: Percentage of lessons completed
                          pctCompleteXP:
                            type:
                              - number
                              - 'null'
                            description: Percentage of XP earned
                          totalXP:
                            type: number
                            description: Total XP available in the course
                          earnedXP:
                            type: number
                            description: XP earned by the student
                          remainingXP:
                            type: number
                            description: Remaining XP to earn
                          totalUnits:
                            type: number
                            description: Total units (components) in the course
                          completedUnits:
                            type: number
                            description: Number of completed units
                          remainingUnits:
                            type: number
                            description: Number of remaining units
                          totalLessons:
                            type: number
                            description: Total lessons in the course
                          completedLessons:
                            type: number
                            description: Number of completed lessons
                          remainingLessons:
                            type: number
                            description: Number of remaining lessons
                        required:
                          - courseId
                          - courseTitle
                          - pctComplete
                          - pctCompleteApp
                          - pctCompleteLessons
                          - pctCompleteXP
                          - totalXP
                          - earnedXP
                          - remainingXP
                          - totalUnits
                          - completedUnits
                          - remainingUnits
                          - totalLessons
                          - completedLessons
                          - remainingLessons
                    required:
                      - course
                      - goal
                      - progress
                required:
                  - preview
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /goals/{studentId}/subjects:
    get:
      operationId: listGoalSubjects
      summary: List subject goal snapshots for a student
      description: >-
        Primary K-8 goals read model. Returns one product-shaped row per subject
        with the managed baseline minimum, active learner-facing outcome goal,
        saved routed execution snapshot, and current computed pace/projection
        state.
      tags:
        - Goals
      parameters:
        - name: studentId
          description: Student sourcedId
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Subject goal snapshots returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  studentId:
                    type: string
                    description: Student sourcedId
                  subjects:
                    type: array
                    items:
                      type: object
                      properties:
                        subject:
                          type: string
                          description: Goal subject
                        baseline:
                          type:
                            - object
                            - 'null'
                          properties:
                            goalId:
                              type: string
                              description: Managed minimum-goal identifier
                            dailyTargetXP:
                              type: number
                              description: Current baseline daily XP target
                            defaultDailyTargetXP:
                              type: number
                              description: Default baseline daily XP target for the subject
                            startDate:
                              type: string
                              description: Managed minimum goal start date
                            updatedAt:
                              type:
                                - string
                                - 'null'
                              description: Last date the managed minimum goal was updated
                          required:
                            - goalId
                            - dailyTargetXP
                            - defaultDailyTargetXP
                            - startDate
                            - updatedAt
                          description: >-
                            Managed minimum baseline policy when one exists for
                            the subject
                        goal:
                          type:
                            - object
                            - 'null'
                          properties:
                            id:
                              type: string
                              description: Active subject-outcome goal identifier
                            type:
                              type: string
                              enum: &ref_6
                                - grade_mastery
                                - percentile
                                - x_factor
                              description: Subject-outcome goal type
                            status:
                              type: string
                              enum: *ref_5
                              description: Business status for the saved subject goal
                            startDate:
                              type: string
                              description: Subject-outcome goal start date
                            updatedAt:
                              type:
                                - string
                                - 'null'
                              description: Last date the subject-outcome goal was updated
                            objective:
                              type: object
                              properties:
                                type:
                                  type: string
                                  enum: *ref_6
                                  description: Learner-facing K-8 subject objective type
                                value:
                                  type: string
                                  minLength: 1
                                  description: >-
                                    Objective value (grade level, percentile, or
                                    x-factor multiplier)
                              required:
                                - type
                                - value
                            pacing:
                              type: object
                              properties:
                                mode:
                                  type:
                                    - string
                                    - 'null'
                                  enum:
                                    - target_date
                                    - daily_time
                                    - null
                                  description: How the subject goal pace is set
                                endDate:
                                  type:
                                    - string
                                    - 'null'
                                  description: >-
                                    Optional target end date in YYYY-MM-DD
                                    format
                                dailyTargetXP:
                                  type:
                                    - number
                                    - 'null'
                                  exclusiveMinimum: 0
                                  description: Daily XP budget used for daily_time previews
                              required:
                                - mode
                                - endDate
                          required:
                            - id
                            - type
                            - status
                            - startDate
                            - updatedAt
                            - objective
                            - pacing
                          description: >-
                            Active learner-facing subject-outcome goal, if one
                            exists
                        execution:
                          type:
                            - object
                            - 'null'
                          properties:
                            stageId:
                              type:
                                - string
                                - 'null'
                              description: Saved routed stage identifier when applicable
                            courseIds:
                              type: array
                              items:
                                type: string
                              description: Saved routed course-path snapshot for execution
                          required:
                            - stageId
                            - courseIds
                          description: >-
                            Saved routed execution snapshot for the active
                            subject goal
                        computed:
                          type: object
                          properties:
                            xp:
                              type:
                                - object
                                - 'null'
                              properties:
                                total:
                                  type: number
                                  description: Total XP tracked by the goal
                                earned:
                                  type: number
                                  description: XP already earned toward the goal
                                remaining:
                                  type: number
                                  description: Remaining XP to complete the goal
                                pctComplete:
                                  type: number
                                  description: Completion percentage from 0 to 100
                              required:
                                - total
                                - earned
                                - remaining
                                - pctComplete
                              description: >-
                                Goal-tracked XP totals when an active
                                subject-outcome goal exists
                            pace:
                              type: object
                              properties:
                                requiredDailyXP:
                                  type:
                                    - number
                                    - 'null'
                                  description: >-
                                    Per-goal daily XP required on the current
                                    timeline
                                effectiveDailyXP:
                                  type:
                                    - number
                                    - 'null'
                                  description: >-
                                    Effective daily XP after combining all
                                    subject goal pressure
                                schoolDaysRemaining:
                                  type:
                                    - number
                                    - 'null'
                                  description: >-
                                    Remaining school days on the current
                                    timeline
                              required:
                                - requiredDailyXP
                                - effectiveDailyXP
                                - schoolDaysRemaining
                            projection:
                              type: object
                              properties:
                                currentGrade:
                                  type:
                                    - string
                                    - 'null'
                                  description: Current highest grade mastered
                                daysToNextGrade:
                                  type:
                                    - number
                                    - 'null'
                                  description: Days until next grade is mastered
                                gradeTimeline:
                                  type: array
                                  items:
                                    type: object
                                    properties:
                                      grade:
                                        type: string
                                        description: Grade level
                                      courseIds:
                                        type: array
                                        items:
                                          type: string
                                        description: >-
                                          Course IDs used to compute this grade
                                          milestone. Clients can use these to
                                          scope graph activity to the same course
                                          path.
                                      remainingXP:
                                        type: number
                                        description: XP remaining to complete this grade
                                      daysToComplete:
                                        type: number
                                        description: School days needed at current pace
                                      projectedDate:
                                        type:
                                          - string
                                          - 'null'
                                        description: Projected completion date
                                      status:
                                        type: string
                                        enum: &ref_7
                                          - completed
                                          - in_progress
                                          - future
                                        description: >-
                                          Projected status of the grade at the
                                          current pace
                                      totalXP:
                                        type: number
                                        description: Total XP in the grade band
                                      earnedXP:
                                        type: number
                                        description: XP already earned in the grade band
                                    required:
                                      - grade
                                      - remainingXP
                                      - daysToComplete
                                      - projectedDate
                                      - status
                                      - totalXP
                                      - earnedXP
                                  description: >-
                                    Timeline showing when each grade will be
                                    reached
                              required:
                                - currentGrade
                                - daysToNextGrade
                                - gradeTimeline
                            resolution:
                              type:
                                - object
                                - 'null'
                              properties:
                                strategy:
                                  type: string
                                  enum: &ref_8
                                    - percentile
                                    - x_factor
                                  description: >-
                                    Milestone resolution strategy used to
                                    determine the target grade
                                resolvedTargetGrade:
                                  type: string
                                  description: >-
                                    Resolved target grade after applying the
                                    strategy
                                targetRit:
                                  type:
                                    - number
                                    - 'null'
                                  description: >-
                                    Target RIT produced by the milestone
                                    strategy when applicable
                              required:
                                - strategy
                                - resolvedTargetGrade
                                - targetRit
                              description: >-
                                Resolved milestone target details when
                                applicable
                            issue:
                              type:
                                - object
                                - 'null'
                              properties:
                                code:
                                  type: string
                                  enum: &ref_9
                                    - missing_starting_grade
                                    - dependency_unavailable
                                    - target_unavailable
                                    - goal_unavailable
                                  description: >-
                                    Machine-readable reason computed fields are
                                    unavailable
                                message:
                                  type: string
                                  description: Human-readable issue summary
                                service:
                                  type:
                                    - string
                                    - 'null'
                                  description: Upstream service name when dependency-backed
                                path:
                                  type:
                                    - string
                                    - 'null'
                                  description: Upstream route path when available
                                status:
                                  type:
                                    - number
                                    - 'null'
                                  description: Upstream HTTP status when available
                              required:
                                - code
                                - message
                                - service
                                - path
                                - status
                              description: >-
                                Subject-scoped availability issue. List
                                endpoints may return this instead of failing the
                                entire page.
                          required:
                            - xp
                            - pace
                            - projection
                            - resolution
                      required:
                        - subject
                        - baseline
                        - goal
                        - execution
                        - computed
                required:
                  - studentId
                  - subjects
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
    post:
      operationId: createSubjectGoal
      summary: Create a learner-facing subject goal
      description: >-
        Creates or replaces the active K-8 learner-facing outcome goal for a
        subject. The service resolves a stable routed course path at save time
        and stores that execution snapshot behind the product-shaped response.
      tags:
        - Goals
      parameters:
        - name: studentId
          description: Student sourcedId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                subject:
                  type: string
                  description: Subject for the learner-facing goal
                  enum: &ref_11
                    - Reading
                    - Language
                    - Vocabulary
                    - Social Studies
                    - Writing
                    - Science
                    - FastMath
                    - Math
                    - None
                    - Other
                objective:
                  type: object
                  properties:
                    type:
                      type: string
                      enum: *ref_6
                      description: Learner-facing K-8 subject objective type
                    value:
                      type: string
                      minLength: 1
                      description: >-
                        Objective value (grade level, percentile, or x-factor
                        multiplier)
                  required:
                    - type
                    - value
                pacing:
                  type: object
                  properties:
                    mode:
                      type: string
                      enum: &ref_10
                        - target_date
                        - daily_time
                      description: How the subject goal pace is set
                    endDate:
                      type:
                        - string
                        - 'null'
                      description: Optional target end date for target_date pacing
                    dailyTargetXP:
                      type:
                        - number
                        - 'null'
                      exclusiveMinimum: 0
                      description: Daily XP budget for daily_time pacing
                  required:
                    - mode
                  description: Pacing controls for the subject goal
              required:
                - subject
                - objective
                - pacing
      responses:
        '201':
          description: Subject goal created
          content:
            application/json:
              schema:
                type: object
                properties:
                  subject:
                    type: object
                    properties:
                      subject:
                        type: string
                        description: Goal subject
                      baseline:
                        type:
                          - object
                          - 'null'
                        properties:
                          goalId:
                            type: string
                            description: Managed minimum-goal identifier
                          dailyTargetXP:
                            type: number
                            description: Current baseline daily XP target
                          defaultDailyTargetXP:
                            type: number
                            description: Default baseline daily XP target for the subject
                          startDate:
                            type: string
                            description: Managed minimum goal start date
                          updatedAt:
                            type:
                              - string
                              - 'null'
                            description: Last date the managed minimum goal was updated
                        required:
                          - goalId
                          - dailyTargetXP
                          - defaultDailyTargetXP
                          - startDate
                          - updatedAt
                        description: >-
                          Managed minimum baseline policy when one exists for
                          the subject
                      goal:
                        type:
                          - object
                          - 'null'
                        properties:
                          id:
                            type: string
                            description: Active subject-outcome goal identifier
                          type:
                            type: string
                            enum: *ref_6
                            description: Subject-outcome goal type
                          status:
                            type: string
                            enum: *ref_5
                            description: Business status for the saved subject goal
                          startDate:
                            type: string
                            description: Subject-outcome goal start date
                          updatedAt:
                            type:
                              - string
                              - 'null'
                            description: Last date the subject-outcome goal was updated
                          objective:
                            type: object
                            properties:
                              type:
                                type: string
                                enum: *ref_6
                                description: Learner-facing K-8 subject objective type
                              value:
                                type: string
                                minLength: 1
                                description: >-
                                  Objective value (grade level, percentile, or
                                  x-factor multiplier)
                            required:
                              - type
                              - value
                          pacing:
                            type: object
                            properties:
                              mode:
                                type:
                                  - string
                                  - 'null'
                                enum:
                                  - target_date
                                  - daily_time
                                  - null
                                description: How the subject goal pace is set
                              endDate:
                                type:
                                  - string
                                  - 'null'
                                description: Optional target end date in YYYY-MM-DD format
                              dailyTargetXP:
                                type:
                                  - number
                                  - 'null'
                                exclusiveMinimum: 0
                                description: Daily XP budget used for daily_time previews
                            required:
                              - mode
                              - endDate
                        required:
                          - id
                          - type
                          - status
                          - startDate
                          - updatedAt
                          - objective
                          - pacing
                        description: >-
                          Active learner-facing subject-outcome goal, if one
                          exists
                      execution:
                        type:
                          - object
                          - 'null'
                        properties:
                          stageId:
                            type:
                              - string
                              - 'null'
                            description: Saved routed stage identifier when applicable
                          courseIds:
                            type: array
                            items:
                              type: string
                            description: Saved routed course-path snapshot for execution
                        required:
                          - stageId
                          - courseIds
                        description: >-
                          Saved routed execution snapshot for the active subject
                          goal
                      computed:
                        type: object
                        properties:
                          xp:
                            type:
                              - object
                              - 'null'
                            properties:
                              total:
                                type: number
                                description: Total XP tracked by the goal
                              earned:
                                type: number
                                description: XP already earned toward the goal
                              remaining:
                                type: number
                                description: Remaining XP to complete the goal
                              pctComplete:
                                type: number
                                description: Completion percentage from 0 to 100
                            required:
                              - total
                              - earned
                              - remaining
                              - pctComplete
                            description: >-
                              Goal-tracked XP totals when an active
                              subject-outcome goal exists
                          pace:
                            type: object
                            properties:
                              requiredDailyXP:
                                type:
                                  - number
                                  - 'null'
                                description: >-
                                  Per-goal daily XP required on the current
                                  timeline
                              effectiveDailyXP:
                                type:
                                  - number
                                  - 'null'
                                description: >-
                                  Effective daily XP after combining all subject
                                  goal pressure
                              schoolDaysRemaining:
                                type:
                                  - number
                                  - 'null'
                                description: Remaining school days on the current timeline
                            required:
                              - requiredDailyXP
                              - effectiveDailyXP
                              - schoolDaysRemaining
                          projection:
                            type: object
                            properties:
                              currentGrade:
                                type:
                                  - string
                                  - 'null'
                                description: Current highest grade mastered
                              daysToNextGrade:
                                type:
                                  - number
                                  - 'null'
                                description: Days until next grade is mastered
                              gradeTimeline:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    grade:
                                      type: string
                                      description: Grade level
                                    courseIds:
                                      type: array
                                      items:
                                        type: string
                                      description: >-
                                        Course IDs used to compute this grade
                                        milestone. Clients can use these to
                                        scope graph activity to the same course
                                        path.
                                    remainingXP:
                                      type: number
                                      description: XP remaining to complete this grade
                                    daysToComplete:
                                      type: number
                                      description: School days needed at current pace
                                    projectedDate:
                                      type:
                                        - string
                                        - 'null'
                                      description: Projected completion date
                                    status:
                                      type: string
                                      enum: *ref_7
                                      description: >-
                                        Projected status of the grade at the
                                        current pace
                                    totalXP:
                                      type: number
                                      description: Total XP in the grade band
                                    earnedXP:
                                      type: number
                                      description: XP already earned in the grade band
                                  required:
                                    - grade
                                    - remainingXP
                                    - daysToComplete
                                    - projectedDate
                                    - status
                                    - totalXP
                                    - earnedXP
                                description: >-
                                  Timeline showing when each grade will be
                                  reached
                            required:
                              - currentGrade
                              - daysToNextGrade
                              - gradeTimeline
                          resolution:
                            type:
                              - object
                              - 'null'
                            properties:
                              strategy:
                                type: string
                                enum: *ref_8
                                description: >-
                                  Milestone resolution strategy used to
                                  determine the target grade
                              resolvedTargetGrade:
                                type: string
                                description: >-
                                  Resolved target grade after applying the
                                  strategy
                              targetRit:
                                type:
                                  - number
                                  - 'null'
                                description: >-
                                  Target RIT produced by the milestone strategy
                                  when applicable
                            required:
                              - strategy
                              - resolvedTargetGrade
                              - targetRit
                            description: Resolved milestone target details when applicable
                          issue:
                            type:
                              - object
                              - 'null'
                            properties:
                              code:
                                type: string
                                enum: *ref_9
                                description: >-
                                  Machine-readable reason computed fields are
                                  unavailable
                              message:
                                type: string
                                description: Human-readable issue summary
                              service:
                                type:
                                  - string
                                  - 'null'
                                description: Upstream service name when dependency-backed
                              path:
                                type:
                                  - string
                                  - 'null'
                                description: Upstream route path when available
                              status:
                                type:
                                  - number
                                  - 'null'
                                description: Upstream HTTP status when available
                            required:
                              - code
                              - message
                              - service
                              - path
                              - status
                            description: >-
                              Subject-scoped availability issue. List endpoints
                              may return this instead of failing the entire
                              page.
                        required:
                          - xp
                          - pace
                          - projection
                          - resolution
                    required:
                      - subject
                      - baseline
                      - goal
                      - execution
                      - computed
                required:
                  - subject
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /goals/{studentId}/subjects/{subject}:
    patch:
      operationId: updateSubjectGoal
      summary: Update a learner-facing subject goal
      description: >-
        Updates the active subject-outcome goal for one subject. Recomputes and
        persists the routed course-path snapshot whenever the objective changes.
      tags:
        - Goals
      parameters:
        - name: studentId
          description: Student sourcedId
          in: path
          required: true
          schema:
            type: string
        - name: subject
          description: Subject identifier
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                objective:
                  type: object
                  properties:
                    type:
                      type: string
                      enum: *ref_6
                      description: Learner-facing K-8 subject objective type
                    value:
                      type: string
                      minLength: 1
                      description: >-
                        Objective value (grade level, percentile, or x-factor
                        multiplier)
                  required:
                    - type
                    - value
                pacing:
                  type: object
                  properties:
                    mode:
                      type: string
                      enum: *ref_10
                      description: How the subject goal pace is set
                    endDate:
                      type:
                        - string
                        - 'null'
                      description: Optional target end date for target_date pacing
                    dailyTargetXP:
                      type:
                        - number
                        - 'null'
                      exclusiveMinimum: 0
                      description: Daily XP budget for daily_time pacing
                  required:
                    - mode
      responses:
        '200':
          description: Subject goal updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  subject:
                    type: object
                    properties:
                      subject:
                        type: string
                        description: Goal subject
                      baseline:
                        type:
                          - object
                          - 'null'
                        properties:
                          goalId:
                            type: string
                            description: Managed minimum-goal identifier
                          dailyTargetXP:
                            type: number
                            description: Current baseline daily XP target
                          defaultDailyTargetXP:
                            type: number
                            description: Default baseline daily XP target for the subject
                          startDate:
                            type: string
                            description: Managed minimum goal start date
                          updatedAt:
                            type:
                              - string
                              - 'null'
                            description: Last date the managed minimum goal was updated
                        required:
                          - goalId
                          - dailyTargetXP
                          - defaultDailyTargetXP
                          - startDate
                          - updatedAt
                        description: >-
                          Managed minimum baseline policy when one exists for
                          the subject
                      goal:
                        type:
                          - object
                          - 'null'
                        properties:
                          id:
                            type: string
                            description: Active subject-outcome goal identifier
                          type:
                            type: string
                            enum: *ref_6
                            description: Subject-outcome goal type
                          status:
                            type: string
                            enum: *ref_5
                            description: Business status for the saved subject goal
                          startDate:
                            type: string
                            description: Subject-outcome goal start date
                          updatedAt:
                            type:
                              - string
                              - 'null'
                            description: Last date the subject-outcome goal was updated
                          objective:
                            type: object
                            properties:
                              type:
                                type: string
                                enum: *ref_6
                                description: Learner-facing K-8 subject objective type
                              value:
                                type: string
                                minLength: 1
                                description: >-
                                  Objective value (grade level, percentile, or
                                  x-factor multiplier)
                            required:
                              - type
                              - value
                          pacing:
                            type: object
                            properties:
                              mode:
                                type:
                                  - string
                                  - 'null'
                                enum:
                                  - target_date
                                  - daily_time
                                  - null
                                description: How the subject goal pace is set
                              endDate:
                                type:
                                  - string
                                  - 'null'
                                description: Optional target end date in YYYY-MM-DD format
                              dailyTargetXP:
                                type:
                                  - number
                                  - 'null'
                                exclusiveMinimum: 0
                                description: Daily XP budget used for daily_time previews
                            required:
                              - mode
                              - endDate
                        required:
                          - id
                          - type
                          - status
                          - startDate
                          - updatedAt
                          - objective
                          - pacing
                        description: >-
                          Active learner-facing subject-outcome goal, if one
                          exists
                      execution:
                        type:
                          - object
                          - 'null'
                        properties:
                          stageId:
                            type:
                              - string
                              - 'null'
                            description: Saved routed stage identifier when applicable
                          courseIds:
                            type: array
                            items:
                              type: string
                            description: Saved routed course-path snapshot for execution
                        required:
                          - stageId
                          - courseIds
                        description: >-
                          Saved routed execution snapshot for the active subject
                          goal
                      computed:
                        type: object
                        properties:
                          xp:
                            type:
                              - object
                              - 'null'
                            properties:
                              total:
                                type: number
                                description: Total XP tracked by the goal
                              earned:
                                type: number
                                description: XP already earned toward the goal
                              remaining:
                                type: number
                                description: Remaining XP to complete the goal
                              pctComplete:
                                type: number
                                description: Completion percentage from 0 to 100
                            required:
                              - total
                              - earned
                              - remaining
                              - pctComplete
                            description: >-
                              Goal-tracked XP totals when an active
                              subject-outcome goal exists
                          pace:
                            type: object
                            properties:
                              requiredDailyXP:
                                type:
                                  - number
                                  - 'null'
                                description: >-
                                  Per-goal daily XP required on the current
                                  timeline
                              effectiveDailyXP:
                                type:
                                  - number
                                  - 'null'
                                description: >-
                                  Effective daily XP after combining all subject
                                  goal pressure
                              schoolDaysRemaining:
                                type:
                                  - number
                                  - 'null'
                                description: Remaining school days on the current timeline
                            required:
                              - requiredDailyXP
                              - effectiveDailyXP
                              - schoolDaysRemaining
                          projection:
                            type: object
                            properties:
                              currentGrade:
                                type:
                                  - string
                                  - 'null'
                                description: Current highest grade mastered
                              daysToNextGrade:
                                type:
                                  - number
                                  - 'null'
                                description: Days until next grade is mastered
                              gradeTimeline:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    grade:
                                      type: string
                                      description: Grade level
                                    courseIds:
                                      type: array
                                      items:
                                        type: string
                                      description: >-
                                        Course IDs used to compute this grade
                                        milestone. Clients can use these to
                                        scope graph activity to the same course
                                        path.
                                    remainingXP:
                                      type: number
                                      description: XP remaining to complete this grade
                                    daysToComplete:
                                      type: number
                                      description: School days needed at current pace
                                    projectedDate:
                                      type:
                                        - string
                                        - 'null'
                                      description: Projected completion date
                                    status:
                                      type: string
                                      enum: *ref_7
                                      description: >-
                                        Projected status of the grade at the
                                        current pace
                                    totalXP:
                                      type: number
                                      description: Total XP in the grade band
                                    earnedXP:
                                      type: number
                                      description: XP already earned in the grade band
                                  required:
                                    - grade
                                    - remainingXP
                                    - daysToComplete
                                    - projectedDate
                                    - status
                                    - totalXP
                                    - earnedXP
                                description: >-
                                  Timeline showing when each grade will be
                                  reached
                            required:
                              - currentGrade
                              - daysToNextGrade
                              - gradeTimeline
                          resolution:
                            type:
                              - object
                              - 'null'
                            properties:
                              strategy:
                                type: string
                                enum: *ref_8
                                description: >-
                                  Milestone resolution strategy used to
                                  determine the target grade
                              resolvedTargetGrade:
                                type: string
                                description: >-
                                  Resolved target grade after applying the
                                  strategy
                              targetRit:
                                type:
                                  - number
                                  - 'null'
                                description: >-
                                  Target RIT produced by the milestone strategy
                                  when applicable
                            required:
                              - strategy
                              - resolvedTargetGrade
                              - targetRit
                            description: Resolved milestone target details when applicable
                          issue:
                            type:
                              - object
                              - 'null'
                            properties:
                              code:
                                type: string
                                enum: *ref_9
                                description: >-
                                  Machine-readable reason computed fields are
                                  unavailable
                              message:
                                type: string
                                description: Human-readable issue summary
                              service:
                                type:
                                  - string
                                  - 'null'
                                description: Upstream service name when dependency-backed
                              path:
                                type:
                                  - string
                                  - 'null'
                                description: Upstream route path when available
                              status:
                                type:
                                  - number
                                  - 'null'
                                description: Upstream HTTP status when available
                            required:
                              - code
                              - message
                              - service
                              - path
                              - status
                            description: >-
                              Subject-scoped availability issue. List endpoints
                              may return this instead of failing the entire
                              page.
                        required:
                          - xp
                          - pace
                          - projection
                          - resolution
                    required:
                      - subject
                      - baseline
                      - goal
                      - execution
                      - computed
                required:
                  - subject
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
    delete:
      operationId: deleteSubjectGoal
      summary: Delete the active learner-facing subject goal
      description: >-
        Deletes the active subject-outcome goal for the subject. Managed minimum
        baselines remain in place.
      tags:
        - Goals
      parameters:
        - name: studentId
          description: Student sourcedId
          in: path
          required: true
          schema:
            type: string
        - name: subject
          description: Subject identifier
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: Subject goal deleted
          content: {}
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /goals/{studentId}/subjects/{subject}/minimum:
    patch:
      operationId: patchSubjectMinimum
      summary: Update the managed minimum baseline for a subject
      description: >-
        Updates the managed minimum daily XP baseline for the subject. Minimums
        remain simple baseline policy and are patched separately from
        learner-facing outcome goals.
      tags:
        - Goals
      parameters:
        - name: studentId
          description: Student sourcedId
          in: path
          required: true
          schema:
            type: string
        - name: subject
          description: Subject identifier
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                dailyTargetXP:
                  type: number
                  minimum: 0
                  description: Updated baseline daily XP target for the subject
              required:
                - dailyTargetXP
      responses:
        '200':
          description: Subject baseline updated
          content:
            application/json:
              schema:
                type: object
                properties:
                  subject:
                    type: object
                    properties:
                      subject:
                        type: string
                        description: Goal subject
                      baseline:
                        type:
                          - object
                          - 'null'
                        properties:
                          goalId:
                            type: string
                            description: Managed minimum-goal identifier
                          dailyTargetXP:
                            type: number
                            description: Current baseline daily XP target
                          defaultDailyTargetXP:
                            type: number
                            description: Default baseline daily XP target for the subject
                          startDate:
                            type: string
                            description: Managed minimum goal start date
                          updatedAt:
                            type:
                              - string
                              - 'null'
                            description: Last date the managed minimum goal was updated
                        required:
                          - goalId
                          - dailyTargetXP
                          - defaultDailyTargetXP
                          - startDate
                          - updatedAt
                        description: >-
                          Managed minimum baseline policy when one exists for
                          the subject
                      goal:
                        type:
                          - object
                          - 'null'
                        properties:
                          id:
                            type: string
                            description: Active subject-outcome goal identifier
                          type:
                            type: string
                            enum: *ref_6
                            description: Subject-outcome goal type
                          status:
                            type: string
                            enum: *ref_5
                            description: Business status for the saved subject goal
                          startDate:
                            type: string
                            description: Subject-outcome goal start date
                          updatedAt:
                            type:
                              - string
                              - 'null'
                            description: Last date the subject-outcome goal was updated
                          objective:
                            type: object
                            properties:
                              type:
                                type: string
                                enum: *ref_6
                                description: Learner-facing K-8 subject objective type
                              value:
                                type: string
                                minLength: 1
                                description: >-
                                  Objective value (grade level, percentile, or
                                  x-factor multiplier)
                            required:
                              - type
                              - value
                          pacing:
                            type: object
                            properties:
                              mode:
                                type:
                                  - string
                                  - 'null'
                                enum:
                                  - target_date
                                  - daily_time
                                  - null
                                description: How the subject goal pace is set
                              endDate:
                                type:
                                  - string
                                  - 'null'
                                description: Optional target end date in YYYY-MM-DD format
                              dailyTargetXP:
                                type:
                                  - number
                                  - 'null'
                                exclusiveMinimum: 0
                                description: Daily XP budget used for daily_time previews
                            required:
                              - mode
                              - endDate
                        required:
                          - id
                          - type
                          - status
                          - startDate
                          - updatedAt
                          - objective
                          - pacing
                        description: >-
                          Active learner-facing subject-outcome goal, if one
                          exists
                      execution:
                        type:
                          - object
                          - 'null'
                        properties:
                          stageId:
                            type:
                              - string
                              - 'null'
                            description: Saved routed stage identifier when applicable
                          courseIds:
                            type: array
                            items:
                              type: string
                            description: Saved routed course-path snapshot for execution
                        required:
                          - stageId
                          - courseIds
                        description: >-
                          Saved routed execution snapshot for the active subject
                          goal
                      computed:
                        type: object
                        properties:
                          xp:
                            type:
                              - object
                              - 'null'
                            properties:
                              total:
                                type: number
                                description: Total XP tracked by the goal
                              earned:
                                type: number
                                description: XP already earned toward the goal
                              remaining:
                                type: number
                                description: Remaining XP to complete the goal
                              pctComplete:
                                type: number
                                description: Completion percentage from 0 to 100
                            required:
                              - total
                              - earned
                              - remaining
                              - pctComplete
                            description: >-
                              Goal-tracked XP totals when an active
                              subject-outcome goal exists
                          pace:
                            type: object
                            properties:
                              requiredDailyXP:
                                type:
                                  - number
                                  - 'null'
                                description: >-
                                  Per-goal daily XP required on the current
                                  timeline
                              effectiveDailyXP:
                                type:
                                  - number
                                  - 'null'
                                description: >-
                                  Effective daily XP after combining all subject
                                  goal pressure
                              schoolDaysRemaining:
                                type:
                                  - number
                                  - 'null'
                                description: Remaining school days on the current timeline
                            required:
                              - requiredDailyXP
                              - effectiveDailyXP
                              - schoolDaysRemaining
                          projection:
                            type: object
                            properties:
                              currentGrade:
                                type:
                                  - string
                                  - 'null'
                                description: Current highest grade mastered
                              daysToNextGrade:
                                type:
                                  - number
                                  - 'null'
                                description: Days until next grade is mastered
                              gradeTimeline:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    grade:
                                      type: string
                                      description: Grade level
                                    courseIds:
                                      type: array
                                      items:
                                        type: string
                                      description: >-
                                        Course IDs used to compute this grade
                                        milestone. Clients can use these to
                                        scope graph activity to the same course
                                        path.
                                    remainingXP:
                                      type: number
                                      description: XP remaining to complete this grade
                                    daysToComplete:
                                      type: number
                                      description: School days needed at current pace
                                    projectedDate:
                                      type:
                                        - string
                                        - 'null'
                                      description: Projected completion date
                                    status:
                                      type: string
                                      enum: *ref_7
                                      description: >-
                                        Projected status of the grade at the
                                        current pace
                                    totalXP:
                                      type: number
                                      description: Total XP in the grade band
                                    earnedXP:
                                      type: number
                                      description: XP already earned in the grade band
                                  required:
                                    - grade
                                    - remainingXP
                                    - daysToComplete
                                    - projectedDate
                                    - status
                                    - totalXP
                                    - earnedXP
                                description: >-
                                  Timeline showing when each grade will be
                                  reached
                            required:
                              - currentGrade
                              - daysToNextGrade
                              - gradeTimeline
                          resolution:
                            type:
                              - object
                              - 'null'
                            properties:
                              strategy:
                                type: string
                                enum: *ref_8
                                description: >-
                                  Milestone resolution strategy used to
                                  determine the target grade
                              resolvedTargetGrade:
                                type: string
                                description: >-
                                  Resolved target grade after applying the
                                  strategy
                              targetRit:
                                type:
                                  - number
                                  - 'null'
                                description: >-
                                  Target RIT produced by the milestone strategy
                                  when applicable
                            required:
                              - strategy
                              - resolvedTargetGrade
                              - targetRit
                            description: Resolved milestone target details when applicable
                          issue:
                            type:
                              - object
                              - 'null'
                            properties:
                              code:
                                type: string
                                enum: *ref_9
                                description: >-
                                  Machine-readable reason computed fields are
                                  unavailable
                              message:
                                type: string
                                description: Human-readable issue summary
                              service:
                                type:
                                  - string
                                  - 'null'
                                description: Upstream service name when dependency-backed
                              path:
                                type:
                                  - string
                                  - 'null'
                                description: Upstream route path when available
                              status:
                                type:
                                  - number
                                  - 'null'
                                description: Upstream HTTP status when available
                            required:
                              - code
                              - message
                              - service
                              - path
                              - status
                            description: >-
                              Subject-scoped availability issue. List endpoints
                              may return this instead of failing the entire
                              page.
                        required:
                          - xp
                          - pace
                          - projection
                          - resolution
                    required:
                      - subject
                      - baseline
                      - goal
                      - execution
                      - computed
                required:
                  - subject
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /goals/{studentId}/subjects/preview:
    post:
      operationId: previewSubjectGoal
      summary: Preview a learner-facing subject goal
      description: >-
        Returns the product-shaped subject goal preview with the saved-path
        equivalent execution snapshot and computed pace/projection state,
        without creating or updating a row.
      tags:
        - Goals
      parameters:
        - name: studentId
          description: Student sourcedId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                subject:
                  type: string
                  description: Subject for the learner-facing goal
                  enum: *ref_11
                objective:
                  type: object
                  properties:
                    type:
                      type: string
                      enum: *ref_6
                      description: Learner-facing K-8 subject objective type
                    value:
                      type: string
                      minLength: 1
                      description: >-
                        Objective value (grade level, percentile, or x-factor
                        multiplier)
                  required:
                    - type
                    - value
                pacing:
                  type: object
                  properties:
                    mode:
                      type: string
                      enum: *ref_10
                      description: How the subject goal pace is set
                    endDate:
                      type:
                        - string
                        - 'null'
                      description: Optional target end date for target_date pacing
                    dailyTargetXP:
                      type:
                        - number
                        - 'null'
                      exclusiveMinimum: 0
                      description: Daily XP budget for daily_time pacing
                  required:
                    - mode
                  description: Pacing controls for the subject goal
              required:
                - subject
                - objective
                - pacing
      responses:
        '200':
          description: Subject preview returned
          content:
            application/json:
              schema:
                type: object
                properties:
                  preview:
                    type: object
                    properties:
                      subject:
                        type: string
                        description: Goal subject
                      goal:
                        type: object
                        properties:
                          type:
                            type: string
                            enum: *ref_6
                          objective:
                            type: object
                            properties:
                              type:
                                type: string
                                enum: *ref_6
                                description: Learner-facing K-8 subject objective type
                              value:
                                type: string
                                minLength: 1
                                description: >-
                                  Objective value (grade level, percentile, or
                                  x-factor multiplier)
                            required:
                              - type
                              - value
                          pacing:
                            type: object
                            properties:
                              mode:
                                type:
                                  - string
                                  - 'null'
                                enum:
                                  - target_date
                                  - daily_time
                                  - null
                                description: How the subject goal pace is set
                              endDate:
                                type:
                                  - string
                                  - 'null'
                                description: Optional target end date in YYYY-MM-DD format
                              dailyTargetXP:
                                type:
                                  - number
                                  - 'null'
                                exclusiveMinimum: 0
                                description: Daily XP budget used for daily_time previews
                            required:
                              - mode
                              - endDate
                        required:
                          - type
                          - objective
                          - pacing
                      execution:
                        type: object
                        properties:
                          stageId:
                            type:
                              - string
                              - 'null'
                            description: Saved routed stage identifier when applicable
                          courseIds:
                            type: array
                            items:
                              type: string
                            description: Saved routed course-path snapshot for execution
                        required:
                          - stageId
                          - courseIds
                      computed:
                        type: object
                        properties:
                          xp:
                            type:
                              - object
                              - 'null'
                            properties:
                              total:
                                type: number
                                description: Total XP tracked by the goal
                              earned:
                                type: number
                                description: XP already earned toward the goal
                              remaining:
                                type: number
                                description: Remaining XP to complete the goal
                              pctComplete:
                                type: number
                                description: Completion percentage from 0 to 100
                            required:
                              - total
                              - earned
                              - remaining
                              - pctComplete
                            description: >-
                              Goal-tracked XP totals when an active
                              subject-outcome goal exists
                          pace:
                            type: object
                            properties:
                              requiredDailyXP:
                                type:
                                  - number
                                  - 'null'
                                description: >-
                                  Per-goal daily XP required on the current
                                  timeline
                              effectiveDailyXP:
                                type:
                                  - number
                                  - 'null'
                                description: >-
                                  Effective daily XP after combining all subject
                                  goal pressure
                              schoolDaysRemaining:
                                type:
                                  - number
                                  - 'null'
                                description: Remaining school days on the current timeline
                            required:
                              - requiredDailyXP
                              - effectiveDailyXP
                              - schoolDaysRemaining
                          projection:
                            type: object
                            properties:
                              currentGrade:
                                type:
                                  - string
                                  - 'null'
                                description: Current highest grade mastered
                              daysToNextGrade:
                                type:
                                  - number
                                  - 'null'
                                description: Days until next grade is mastered
                              gradeTimeline:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    grade:
                                      type: string
                                      description: Grade level
                                    courseIds:
                                      type: array
                                      items:
                                        type: string
                                      description: >-
                                        Course IDs used to compute this grade
                                        milestone. Clients can use these to
                                        scope graph activity to the same course
                                        path.
                                    remainingXP:
                                      type: number
                                      description: XP remaining to complete this grade
                                    daysToComplete:
                                      type: number
                                      description: School days needed at current pace
                                    projectedDate:
                                      type:
                                        - string
                                        - 'null'
                                      description: Projected completion date
                                    status:
                                      type: string
                                      enum: *ref_7
                                      description: >-
                                        Projected status of the grade at the
                                        current pace
                                    totalXP:
                                      type: number
                                      description: Total XP in the grade band
                                    earnedXP:
                                      type: number
                                      description: XP already earned in the grade band
                                  required:
                                    - grade
                                    - remainingXP
                                    - daysToComplete
                                    - projectedDate
                                    - status
                                    - totalXP
                                    - earnedXP
                                description: >-
                                  Timeline showing when each grade will be
                                  reached
                            required:
                              - currentGrade
                              - daysToNextGrade
                              - gradeTimeline
                          resolution:
                            type:
                              - object
                              - 'null'
                            properties:
                              strategy:
                                type: string
                                enum: *ref_8
                                description: >-
                                  Milestone resolution strategy used to
                                  determine the target grade
                              resolvedTargetGrade:
                                type: string
                                description: >-
                                  Resolved target grade after applying the
                                  strategy
                              targetRit:
                                type:
                                  - number
                                  - 'null'
                                description: >-
                                  Target RIT produced by the milestone strategy
                                  when applicable
                            required:
                              - strategy
                              - resolvedTargetGrade
                              - targetRit
                            description: Resolved milestone target details when applicable
                          issue:
                            type:
                              - object
                              - 'null'
                            properties:
                              code:
                                type: string
                                enum: *ref_9
                                description: >-
                                  Machine-readable reason computed fields are
                                  unavailable
                              message:
                                type: string
                                description: Human-readable issue summary
                              service:
                                type:
                                  - string
                                  - 'null'
                                description: Upstream service name when dependency-backed
                              path:
                                type:
                                  - string
                                  - 'null'
                                description: Upstream route path when available
                              status:
                                type:
                                  - number
                                  - 'null'
                                description: Upstream HTTP status when available
                            required:
                              - code
                              - message
                              - service
                              - path
                              - status
                            description: >-
                              Subject-scoped availability issue. List endpoints
                              may return this instead of failing the entire
                              page.
                        required:
                          - xp
                          - pace
                          - projection
                          - resolution
                    required:
                      - subject
                      - goal
                      - execution
                      - computed
                required:
                  - preview
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /edubridge/caliper/event:
    post:
      operationId: ingestCaliperEvent
      summary: Ingest a Caliper event
      description: >-
        Receives Caliper events from educational app sensors. The
        caliper-ingestion Lambda debundles multi-event payloads and enqueues
        them on the caliper-events FIFO SQS queue.
      tags:
        - Progression
      security: []
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                sensor:
                  type: string
                  description: Sensor identifier (e.g. app name)
                sendTime:
                  type: string
                  description: ISO 8601 timestamp of when the envelope was sent
                dataVersion:
                  type: string
                  description: >-
                    Caliper data version (e.g.
                    http://purl.imsglobal.org/ctx/caliper/v1p2)
                data:
                  type: array
                  items:
                    type: object
                    additionalProperties: {}
                  description: Array of Caliper event objects
              required:
                - sensor
                - sendTime
                - data
      responses:
        '200':
          description: Events ingested
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    const: true
                  message:
                    type: string
                    description: Status message from the caliper ingestion Lambda
                required:
                  - success
                  - message
        '502':
          description: Lambda proxy error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message
                  details:
                    description: Additional error details
                required:
                  - error
  /edubridge/progression/catalog:
    get:
      operationId: browseLessonCatalog
      summary: Browse available lessons
      description: >-

        Proxies the request to the Timeback Bridge catalog API to browse
        available lessons for hole-filling course creation.


        Use the optional filters to narrow down lessons by subject and grade
        level. You can specify multiple values for `subject` and `gradeLevel` by
        repeating the query parameter.


        **Pagination:**

        - Default: 100 lessons per page, max: 500

        - Use `page` and `limit` parameters to control pagination


        **Typical workflow:** Query the catalog for specific grades and
        subjects, review available lessons, then select the ones that match
        identified knowledge gaps to create a targeted course via POST
        /create-course.
            
      tags:
        - Progression
      parameters:
        - in: query
          name: app
          description: Educational app to query
          schema:
            type: string
            description: Educational app to query
            example: freckle
          required: true
        - in: query
          name: subject
          description: >-
            Filter by subject area. Can specify multiple subjects by repeating
            the parameter.
          schema:
            anyOf:
              - type: string
              - type: array
                items:
                  type: string
            description: >-
              Filter by subject area. Can specify multiple subjects by repeating
              the parameter.
            example: math
        - in: query
          name: gradeLevel
          description: >-
            Filter by grade level. Can specify multiple grades by repeating the
            parameter. Valid grades: P, K, 1-12
          schema:
            anyOf:
              - type: string
              - type: array
                items:
                  type: string
            description: >-
              Filter by grade level. Can specify multiple grades by repeating
              the parameter. Valid grades: P, K, 1-12
            example: '5'
        - in: query
          name: page
          description: Page number (starts at 1)
          schema:
            type: integer
            minimum: 1
            default: 1
            description: Page number (starts at 1)
            example: 1
        - in: query
          name: limit
          description: Number of items per page (max 500)
          schema:
            type: integer
            minimum: 1
            maximum: 500
            default: 100
            description: Number of items per page (max 500)
            example: 100
      responses:
        '200':
          description: Lessons retrieved successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  app:
                    type: string
                    description: Educational app name
                    example: freckle
                  lastRefreshed:
                    type:
                      - string
                      - 'null'
                    description: Timestamp when the catalog was last updated from the app
                    example: 2025-11-01T14:30:00.000Z
                  lessons:
                    type: array
                    items:
                      type: object
                      properties:
                        lessonId:
                          type: string
                          description: Unique identifier for the lesson
                        lessonName:
                          type: string
                          description: Human-readable name of the lesson
                        subject:
                          type: string
                          description: Primary subject area (e.g., math, ela)
                        subjects:
                          type: array
                          items:
                            type: string
                          default: []
                          description: All subjects this lesson belongs to
                        gradeLevel:
                          type: string
                          description: Grade level (e.g., K, 1, 5, 12)
                        standards:
                          type: array
                          items:
                            type: string
                          default: []
                          description: Educational standards covered (CCSS, TEKS, etc.)
                        metadata:
                          type:
                            - object
                            - 'null'
                          additionalProperties: {}
                          description: >-
                            Additional lesson metadata including description for
                            AI interpretation
                      required:
                        - lessonId
                        - lessonName
                        - subject
                        - subjects
                        - gradeLevel
                        - standards
                    description: Available lessons matching the filter criteria
                  pagination:
                    type: object
                    properties:
                      page:
                        type: number
                        description: Current page number (1-indexed)
                        example: 1
                      limit:
                        type: number
                        description: Number of items per page
                        example: 100
                      total:
                        type: number
                        description: Total number of items matching the filters
                        example: 42
                      totalPages:
                        type: number
                        description: Total number of pages available
                        example: 1
                    required:
                      - page
                      - limit
                      - total
                      - totalPages
                required:
                  - app
                  - lastRefreshed
                  - lessons
                  - pagination
        '400':
          description: Invalid app name or parameters
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: invalid_app
                  message:
                    type: string
                    example: 'App must be one of: freckle'
                  statusCode:
                    type: number
                    example: 400
                  details:
                    type: object
                    additionalProperties: {}
                required:
                  - error
                  - message
                  - statusCode
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /edubridge/progression/create-course:
    post:
      operationId: createHoleFillingCourse
      summary: Create a hole-filling course and enroll student
      description: >-

        Proxies the request to the AlphaTest Courses API to create a
        hole-filling course with selected lessons, enroll the student, and
        configure post-completion behavior.


        **Workflow:**

        1. Call GET /catalog to browse available lessons and get valid
        `lessonId` values

        2. Call this endpoint with the selected lessons


        **The `next` field** controls what happens when the student completes
        the course:

        - `"assessment"` — assign an end-of-course assessment for the same
        subject/grade

        - A valid course UUID — unenroll from this course and enroll in the
        specified course


        **Notes:**

        - Grade format is flexible: `"5"`, `5`, `"K"` all work

        - The API does NOT deduplicate — calling twice creates two courses

        - Course creation can take up to ~90s for adapter apps due to external
        job polling
            
      tags:
        - Progression
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                subject:
                  type: string
                  enum:
                    - math
                    - reading
                    - science
                    - writing
                    - language
                    - ela
                  description: Subject area
                  example: science
                grade:
                  anyOf:
                    - type: string
                    - type: number
                  description: 'Grade level: "PK", "K", or 1-12 (string or number)'
                  example: 7
                app:
                  type: string
                  enum:
                    - edia
                    - freckle
                    - mobymax
                    - vocabloco
                    - lalilo
                    - anton
                    - alphawrite
                    - timeback
                  description: Learning application
                  example: mobymax
                email:
                  type: string
                  format: email
                  description: Student email - must exist in Timeback
                  example: student@alpha.school
                next:
                  type: string
                  description: >-
                    "assessment" to assign an end-of-course assessment, or a
                    valid course UUID to enroll in next
                  example: assessment
                lessonIds:
                  type: array
                  items:
                    type: string
                  minItems: 1
                  description: Lesson IDs from the catalog
                  example:
                    - mobymax_science_1883_g7
                    - mobymax_science_1878_g7
                courseDetails:
                  type: object
                  properties:
                    title:
                      type: string
                      minLength: 1
                      description: Course display title
                      example: Science Gap Fill
                    xpPerLesson:
                      type: number
                      description: XP awarded per lesson (uses app default if omitted)
                    metadata:
                      type: object
                      additionalProperties: {}
                      description: Arbitrary metadata attached to the course
                  required:
                    - title
              required:
                - subject
                - grade
                - app
                - email
                - next
                - lessonIds
                - courseDetails
      responses:
        '201':
          description: Course created and student enrolled
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    const: true
                  course:
                    type: object
                    properties:
                      sourcedId:
                        type: string
                        description: OneRoster course ID
                        example: a1b2c3d4-e5f6-7890-abcd-ef1234567890
                      title:
                        type: string
                        example: '[MobyMax] - Custom Science Course HF custom'
                      totalLessons:
                        type: number
                        example: 3
                      totalXp:
                        type: number
                        example: 45
                    required:
                      - sourcedId
                      - title
                      - totalLessons
                      - totalXp
                  enrollment:
                    type: object
                    properties:
                      statusCode:
                        type: number
                        example: 200
                      message:
                        type: string
                        example: Enrollment successful
                    required:
                      - statusCode
                      - message
                  resourcesCreated:
                    type: number
                    example: 3
                  resourcesFailed:
                    type: number
                    example: 0
                required:
                  - success
                  - course
                  - enrollment
                  - resourcesCreated
                  - resourcesFailed
        '400':
          description: >-
            Validation error (missing/invalid field, invalid grade, bad next
            value)
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    const: false
                  error:
                    type: string
                    example: subject is required
                  details:
                    type: object
                    additionalProperties: {}
                required:
                  - success
                  - error
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Student not found for the given email
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    const: false
                  error:
                    type: string
                    example: subject is required
                  details:
                    type: object
                    additionalProperties: {}
                required:
                  - success
                  - error
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /edubridge/progression/enqueue:
    post:
      operationId: enqueueProgression
      summary: Enqueue a student progression job
      description: >-
        Called by AlphaTest DCAN after completing gap analysis. The
        progression-enqueue Lambda places a message on the student-progression
        SQS queue.
      tags:
        - Progression
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                assignmentId:
                  type: number
                  description: The assignment ID from AlphaTest
                studentTimebackId:
                  type: string
                  description: The student's Timeback sourced ID
                studentEmail:
                  type: string
                  description: The student's email address
                subject:
                  type: string
                  description: Academic subject (e.g. Math, Language)
                grade:
                  type: string
                  description: Grade level (e.g. 5, K)
                currentCourseSourcedId:
                  type: string
                  description: The sourced ID of the student's current course
                flowType:
                  type: string
                  enum:
                    - dcan
                    - existingPlan
                    - legacy
                  description: The progression flow type
                score:
                  type: number
                  description: Test score (if applicable)
                testType:
                  type: string
                  description: Type of test (if applicable)
                readOnly:
                  type: boolean
                  description: If true, skip side effects (dry run)
                extendedCatalog:
                  type: boolean
                  description: If true, fetch catalogs for adjacent grades (grade±2)
                aiModel:
                  type: string
                  description: LLM model to use for gap analysis (optional)
                existingPlan:
                  type: boolean
                  description: >-
                    If true, reuse saved lesson recommendations instead of
                    re-fetching
              required:
                - assignmentId
                - studentTimebackId
                - studentEmail
                - subject
                - grade
                - currentCourseSourcedId
                - flowType
      responses:
        '200':
          description: Progression job enqueued
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    const: true
                  messageId:
                    type: string
                    description: SQS message ID
                required:
                  - success
                  - messageId
        '502':
          description: Lambda proxy error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message
                  details:
                    description: Additional error details
                required:
                  - error
  /edubridge/progression/hole-filling-course:
    post:
      operationId: createHoleFillingCourseLambda
      summary: Create a hole-filling course (Lambda)
      description: >-
        Creates a hole-filling course in OneRoster with component resources
        (lessons). Served by the hole-filling-course Lambda.
      tags:
        - Progression
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                studentSourcedId:
                  type: string
                  description: The student's OneRoster sourced ID
                studentEmail:
                  type: string
                  description: The student's email address
                subject:
                  type: string
                  description: Academic subject
                grade:
                  type: string
                  description: Grade level
                lessons:
                  type: array
                  items:
                    type: object
                    properties:
                      lessonId:
                        type: string
                        description: Lesson identifier
                      title:
                        type: string
                        description: Lesson title
                      app:
                        type: string
                        description: Learning app (e.g. MobyMax, Edia)
                      launchUrl:
                        type: string
                        description: Launch URL for the lesson
                      metadata:
                        type: object
                        additionalProperties: {}
                        description: Additional lesson metadata
                    required:
                      - lessonId
                      - title
                      - app
                  description: Lessons to include in the hole-filling course
                gapAnalysisId:
                  type: string
                  description: Gap analysis record ID
                assignmentId:
                  type: number
                  description: The assignment ID from AlphaTest
                baseCourseSourcedId:
                  type: string
                  description: Base course sourced ID for hole-filling lineage
                testType:
                  type: string
                  enum:
                    - end of course
                    - test out
                    - placement
                  description: Type of test that triggered hole-filling
                missedQuestions:
                  type: array
                  items:
                    type: string
                  description: List of missed question IDs
              required:
                - studentSourcedId
                - studentEmail
                - subject
                - grade
                - lessons
                - gapAnalysisId
                - assignmentId
      responses:
        '200':
          description: Hole-filling course created
          content:
            application/json:
              schema:
                type: object
                properties:
                  courseSourcedId:
                    type: string
                    description: Created course sourced ID
                  classSourcedId:
                    type:
                      - string
                      - 'null'
                    description: Created class sourced ID (null if enrollment failed)
                  enrollmentSourcedId:
                    type:
                      - string
                      - 'null'
                    description: Created enrollment sourced ID (null if enrollment failed)
                required:
                  - courseSourcedId
                  - classSourcedId
                  - enrollmentSourcedId
        '502':
          description: Lambda proxy error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    description: Error message
                  details:
                    description: Additional error details
                required:
                  - error
  /edubridge/progression/status:
    post:
      operationId: enqueueProgressionStatus
      summary: Publish progression status update (Lambda)
      description: >-
        Enqueues a progression status update to the FIFO queue. The consumer
        Lambda writes it to the student's user metadata in OneRoster. If the
        studentTimebackId does not exist in OneRoster, the request is accepted
        but skipped — the response will include `skipped: true` and a `reason`
        field. Served by the progression-status-enqueue Lambda.
      tags:
        - Progression
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                studentTimebackId:
                  type: string
                subject:
                  type: string
                status:
                  type: string
                  enum:
                    - gap_analysis_in_progress
                    - gap_analysis_completed
                    - gap_analysis_bypassed
                    - gap_analysis_failed
                    - hf_lesson_picking_in_progress
                    - hf_lesson_picking_completed
                    - hf_lesson_picking_failed
                    - hole_filling_generation_in_progress
                    - hole_filling_generation_completed
                    - hole_filling_generation_failed
                    - test_assignment_completed
                    - test_exhaustion
                    - test_assignment_failed
                    - course_assignment_completed
                    - course_assignment_failed
                    - reassignment_in_progress
                    - reassignment_completed
                    - reassignment_failed
                firedAt:
                  type: string
                failureReason:
                  type: string
              required:
                - studentTimebackId
                - subject
                - status
      responses:
        '200':
          description: >-
            Status message enqueued, or skipped if user not found. Check
            `skipped` field to distinguish.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    const: true
                  messageId:
                    type: string
                  skipped:
                    type: boolean
                  reason:
                    type: string
                required:
                  - success
        '400':
          description: Validation error (missing or invalid fields)
  /edubridge/users/:
    get:
      operationId: getUsersByRole
      summary: Get users by exclusive role
      description: >

        Returns all users who have exclusively the specified role.


        This endpoint filters users to only return those who have one or more
        instances of the specified role 

        but no other types of roles. For example, if a user has both "student"
        and "guide" roles, 

        they will not be returned when filtering for "student".


        The response uses the same format as the OneRoster users endpoint.
      tags:
        - Users
      parameters:
        - in: query
          name: fields
          description: Comma-separated list of fields to include in the response
          schema:
            type: string
            description: Comma-separated list of fields to include in the response
            example: sourcedId,name
        - in: query
          name: limit
          description: >-
            The maximum number of items to return in the paginated response.
            While the OneRoster specification does not define a maximum limit,
            this implementation enforces a maximum of 3000 to prevent abuse and
            ensure optimal performance.
          schema:
            type: integer
            minimum: 1
            maximum: 3000
            default: 100
            description: >-
              The maximum number of items to return in the paginated response.
              While the OneRoster specification does not define a maximum limit,
              this implementation enforces a maximum of 3000 to prevent abuse
              and ensure optimal performance.
            example: 100
        - in: query
          name: offset
          description: The number of items to skip in the paginated response
          schema:
            type: integer
            minimum: 0
            default: 0
            description: The number of items to skip in the paginated response
            example: 0
        - in: query
          name: sort
          description: The field to sort the response by
          schema:
            type: string
            description: The field to sort the response by
        - in: query
          name: orderBy
          description: The order to sort the response by
          schema:
            type: string
            enum:
              - asc
              - desc
            description: The order to sort the response by
        - in: query
          name: filter
          description: The filter to apply to the response
          schema:
            type: string
            description: The filter to apply to the response
            example: status='active'
        - in: query
          name: search
          description: >-
            PROPRIETARY EXTENSION: Free-text search across multiple fields.
            Provides convenient text-based querying beyond the standard
            OneRoster filter parameter.
          schema:
            type: string
            description: >-
              PROPRIETARY EXTENSION: Free-text search across multiple fields.
              Provides convenient text-based querying beyond the standard
              OneRoster filter parameter.
            example: john
        - in: query
          name: roles
          schema:
            type: array
            items:
              type: string
              enum: &ref_12
                - administrator
                - aide
                - guardian
                - parent
                - proctor
                - relative
                - student
                - teacher
            minItems: 1
          required: true
        - in: query
          name: orgSourcedIds
          schema:
            type: array
            items:
              type: string
      responses:
        '200':
          description: Successful response containing a collection of users
          content:
            application/json:
              schema:
                type: object
                properties:
                  users:
                    type: array
                    items:
                      type: object
                      properties:
                        sourcedId:
                          type: string
                        status:
                          type: string
                          enum: &ref_13
                            - active
                            - tobedeleted
                        dateLastModified:
                          type: string
                          format: date-time
                        metadata:
                          type: object
                          additionalProperties: true
                          nullable: true
                          description: Additional metadata for the object
                        userMasterIdentifier:
                          type:
                            - string
                            - 'null'
                        username:
                          type:
                            - string
                            - 'null'
                        userIds:
                          type: array
                          items:
                            type: object
                            properties:
                              type:
                                type: string
                              identifier:
                                type: string
                            required:
                              - type
                              - identifier
                        enabledUser:
                          type: string
                          enum:
                            - 'true'
                            - 'false'
                        givenName:
                          type: string
                        familyName:
                          type: string
                        middleName:
                          type:
                            - string
                            - 'null'
                        roles:
                          type: array
                          items:
                            type: object
                            properties:
                              roleType:
                                type: string
                                enum:
                                  - primary
                                  - secondary
                              role:
                                type: string
                                enum: *ref_12
                              org:
                                type: object
                                properties:
                                  href:
                                    type: string
                                    format: uri
                                  sourcedId:
                                    type: string
                                  type:
                                    type: string
                                required:
                                  - href
                                  - sourcedId
                                  - type
                              userProfile:
                                type: string
                              metadata:
                                type:
                                  - object
                                  - 'null'
                                additionalProperties: {}
                              beginDate:
                                type:
                                  - string
                                  - 'null'
                              endDate:
                                type:
                                  - string
                                  - 'null'
                            required:
                              - roleType
                              - role
                              - org
                          default: []
                        agents:
                          type: array
                          items:
                            type: object
                            properties:
                              href:
                                type: string
                                format: uri
                              sourcedId:
                                type: string
                              type:
                                type: string
                                enum:
                                  - academicSession
                                  - assessmentLineItem
                                  - category
                                  - class
                                  - course
                                  - demographics
                                  - enrollment
                                  - gradingPeriod
                                  - lineItem
                                  - org
                                  - resource
                                  - result
                                  - scoreScale
                                  - student
                                  - teacher
                                  - term
                                  - user
                                  - componentResource
                                  - courseComponent
                            required:
                              - href
                              - sourcedId
                              - type
                          default: []
                        userProfiles:
                          type: array
                          items:
                            type: object
                            properties:
                              profileId:
                                type: string
                              profileType:
                                type: string
                              vendorId:
                                type: string
                              applicationId:
                                type: string
                              description:
                                type:
                                  - string
                                  - 'null'
                              app:
                                type: object
                                properties:
                                  sourcedId:
                                    type: string
                                  name:
                                    type: string
                                  description:
                                    type:
                                      - string
                                      - 'null'
                                  domain:
                                    type: array
                                    items:
                                      type: string
                                  metadata:
                                    type:
                                      - object
                                      - 'null'
                                    additionalProperties: {}
                                required:
                                  - sourcedId
                                  - name
                                  - domain
                              credentials:
                                type: array
                                items:
                                  type: object
                                  properties:
                                    id:
                                      type: string
                                    type:
                                      type: string
                                    username:
                                      type: string
                                    password:
                                      type:
                                        - string
                                        - 'null'
                                  required:
                                    - id
                                    - type
                                    - username
                                default: []
                            required:
                              - profileId
                              - profileType
                              - vendorId
                              - applicationId
                              - app
                              - credentials
                          default: []
                        primaryOrg:
                          type: object
                          properties:
                            href:
                              type: string
                              format: uri
                            sourcedId:
                              type: string
                            type:
                              type: string
                            name:
                              type:
                                - string
                                - 'null'
                          required:
                            - href
                            - sourcedId
                            - type
                        identifier:
                          type:
                            - string
                            - 'null'
                        email:
                          type: string
                          format: email
                          description: Must be unique across all users.
                        preferredFirstName:
                          type:
                            - string
                            - 'null'
                        preferredMiddleName:
                          type:
                            - string
                            - 'null'
                        preferredLastName:
                          type:
                            - string
                            - 'null'
                        pronouns:
                          type:
                            - string
                            - 'null'
                        grades:
                          type: array
                          items:
                            allOf:
                              - $ref: '#/components/schemas/GradeEnum'
                            description: The grades of the course
                            enum: &ref_14
                              - '-1'
                              - '0'
                              - '1'
                              - '2'
                              - '3'
                              - '4'
                              - '5'
                              - '6'
                              - '7'
                              - '8'
                              - '9'
                              - '10'
                              - '11'
                              - '12'
                              - '13'
                        password:
                          type:
                            - string
                            - 'null'
                        sms:
                          type:
                            - string
                            - 'null'
                        phone:
                          type:
                            - string
                            - 'null'
                        demographics:
                          oneOf:
                            - $ref: '#/components/schemas/Demographics'
                            - type: 'null'
                      required:
                        - sourcedId
                        - status
                        - enabledUser
                        - givenName
                        - familyName
                        - roles
                        - agents
                        - userProfiles
                        - email
                      description: >-
                        Represents a user of the system. Can be a student,
                        teacher, guide, parent etc.
                  totalCount:
                    type: number
                  pageCount:
                    type: number
                  pageNumber:
                    type: number
                  offset:
                    type: number
                  limit:
                    type: number
                required:
                  - users
                  - totalCount
                  - pageCount
                  - pageNumber
                  - offset
                  - limit
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /edubridge/learning-reports/map-profile/{userId}:
    get:
      operationId: getMapProfile
      summary: Get the MAP profile for a given student
      description: Return the MAP profile for a given student
      tags:
        - Learning Reports
      parameters:
        - name: userId
          description: The unique identifier for the student
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        title:
                          type: string
                        pdfUrl:
                          type:
                            - string
                            - 'null'
                        tests:
                          type: array
                          items:
                            type: string
                        grade:
                          type: string
                        schoolname:
                          type: string
                        assessmentResultProviderSystem:
                          type: string
                      required:
                        - title
                        - pdfUrl
                        - tests
                required:
                  - data
        '404':
          description: No MAP profile found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
  /edubridge/analytics/activity:
    get:
      operationId: listFactsDateRange
      summary: List all facts for a given date range by email or studentId
      description: >-
        Return a list of processed facts for a given date range by email or
        studentId
      tags:
        - Analytics
      parameters:
        - in: query
          name: email
          schema:
            type: string
            format: email
        - in: query
          name: studentId
          schema:
            type: string
        - in: query
          name: startDate
          schema:
            type: string
            format: date-time
          required: true
        - in: query
          name: endDate
          schema:
            type: string
            format: date-time
          required: true
        - in: query
          name: timezone
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  startDate:
                    type: string
                    format: date-time
                  endDate:
                    type: string
                    format: date-time
                  facts:
                    type: object
                    additionalProperties:
                      type: object
                      additionalProperties:
                        type: object
                        properties:
                          activityMetrics:
                            type: object
                            properties:
                              xpEarned:
                                type: number
                              totalQuestions:
                                type: number
                              correctQuestions:
                                type: number
                              masteredUnits:
                                type: number
                            required:
                              - xpEarned
                              - totalQuestions
                              - correctQuestions
                              - masteredUnits
                          timeSpentMetrics:
                            type: object
                            properties:
                              activeSeconds:
                                type: number
                              inactiveSeconds:
                                type: number
                              wasteSeconds:
                                type: number
                            required:
                              - activeSeconds
                              - inactiveSeconds
                              - wasteSeconds
                          apps:
                            type: array
                            items:
                              type: string
                        required:
                          - activityMetrics
                          - timeSpentMetrics
                          - apps
                  factsByApp:
                    type: object
                    additionalProperties:
                      type: object
                      additionalProperties:
                        type: object
                        additionalProperties:
                          type: object
                          properties:
                            activityMetrics:
                              type: object
                              properties:
                                xpEarned:
                                  type: number
                                totalQuestions:
                                  type: number
                                correctQuestions:
                                  type: number
                                masteredUnits:
                                  type: number
                              required:
                                - xpEarned
                                - totalQuestions
                                - correctQuestions
                                - masteredUnits
                            timeSpentMetrics:
                              type: object
                              properties:
                                activeSeconds:
                                  type: number
                                inactiveSeconds:
                                  type: number
                                wasteSeconds:
                                  type: number
                              required:
                                - activeSeconds
                                - inactiveSeconds
                                - wasteSeconds
                            apps:
                              type: array
                              items:
                                type: string
                          required:
                            - activityMetrics
                            - timeSpentMetrics
                            - apps
                required:
                  - message
                  - startDate
                  - endDate
                  - facts
                  - factsByApp
  /edubridge/analytics/enrollment/{enrollmentId}:
    get:
      operationId: listFactsByEnrollment
      summary: List all facts for a given enrollment
      description: >-
        Return a list of processed facts for a given enrollment with optional
        date range filtering
      tags:
        - Analytics
      parameters:
        - in: path
          name: enrollmentId
          schema:
            type: string
          required: true
        - in: query
          name: startDate
          schema:
            type: string
            format: date-time
        - in: query
          name: endDate
          schema:
            type: string
            format: date-time
        - in: query
          name: timezone
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  enrollmentId:
                    type: string
                  startDate:
                    type: string
                    format: date-time
                  endDate:
                    type: string
                    format: date-time
                  facts:
                    type: object
                    additionalProperties:
                      type: object
                      additionalProperties:
                        type: object
                        properties:
                          activityMetrics:
                            type: object
                            properties:
                              xpEarned:
                                type: number
                              totalQuestions:
                                type: number
                              correctQuestions:
                                type: number
                              masteredUnits:
                                type: number
                            required:
                              - xpEarned
                              - totalQuestions
                              - correctQuestions
                              - masteredUnits
                          timeSpentMetrics:
                            type: object
                            properties:
                              activeSeconds:
                                type: number
                              inactiveSeconds:
                                type: number
                              wasteSeconds:
                                type: number
                            required:
                              - activeSeconds
                              - inactiveSeconds
                              - wasteSeconds
                          apps:
                            type: array
                            items:
                              type: string
                        required:
                          - activityMetrics
                          - timeSpentMetrics
                          - apps
                  factsByApp:
                    type: object
                    additionalProperties:
                      type: object
                      additionalProperties:
                        type: object
                        additionalProperties:
                          type: object
                          properties:
                            activityMetrics:
                              type: object
                              properties:
                                xpEarned:
                                  type: number
                                totalQuestions:
                                  type: number
                                correctQuestions:
                                  type: number
                                masteredUnits:
                                  type: number
                              required:
                                - xpEarned
                                - totalQuestions
                                - correctQuestions
                                - masteredUnits
                            timeSpentMetrics:
                              type: object
                              properties:
                                activeSeconds:
                                  type: number
                                inactiveSeconds:
                                  type: number
                                wasteSeconds:
                                  type: number
                              required:
                                - activeSeconds
                                - inactiveSeconds
                                - wasteSeconds
                            apps:
                              type: array
                              items:
                                type: string
                          required:
                            - activityMetrics
                            - timeSpentMetrics
                            - apps
                required:
                  - message
                  - enrollmentId
                  - facts
                  - factsByApp
  /edubridge/analytics/facts/weekly:
    get:
      operationId: listFactsWeekly
      summary: List all facts for a given week by email or studentId
      description: Return a list of processed facts for a given week by email or studentId
      tags:
        - Analytics
      parameters:
        - in: query
          name: email
          schema:
            type: string
            format: email
        - in: query
          name: studentId
          schema:
            type: string
        - in: query
          name: weekDate
          schema:
            type: string
          required: true
        - in: query
          name: timezone
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  message:
                    type: string
                  startDate:
                    type: string
                    format: date-time
                  endDate:
                    type: string
                    format: date-time
                  facts:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: number
                        email:
                          type: string
                        date:
                          type: string
                        datetime:
                          type: string
                        username:
                          type:
                            - string
                            - 'null'
                        userGrade:
                          type:
                            - string
                            - 'null'
                        userFamilyName:
                          type:
                            - string
                            - 'null'
                        userGivenName:
                          type:
                            - string
                            - 'null'
                        userId:
                          type:
                            - string
                            - 'null'
                        subject:
                          type:
                            - string
                            - 'null'
                        app:
                          type:
                            - string
                            - 'null'
                        courseId:
                          type:
                            - string
                            - 'null'
                        courseName:
                          type:
                            - string
                            - 'null'
                        campusId:
                          type:
                            - string
                            - 'null'
                        campusName:
                          type:
                            - string
                            - 'null'
                        enrollmentId:
                          type:
                            - string
                            - 'null'
                        activityId:
                          type:
                            - string
                            - 'null'
                        activityName:
                          type:
                            - string
                            - 'null'
                        totalQuestions:
                          type:
                            - number
                            - 'null'
                        correctQuestions:
                          type:
                            - number
                            - 'null'
                        xpEarned:
                          type:
                            - number
                            - 'null'
                        masteredUnits:
                          type:
                            - number
                            - 'null'
                        activeSeconds:
                          type:
                            - string
                            - 'null'
                        inactiveSeconds:
                          type:
                            - string
                            - 'null'
                        wasteSeconds:
                          type:
                            - string
                            - 'null'
                        source:
                          type: string
                        alphaLevel:
                          type:
                            - string
                            - 'null'
                        generatedAt:
                          type:
                            - string
                            - 'null'
                        sendTime:
                          type:
                            - string
                            - 'null'
                        sensor:
                          type:
                            - string
                            - 'null'
                        eventType:
                          type:
                            - string
                            - 'null'
                        year:
                          type: number
                        month:
                          type: number
                        day:
                          type: number
                        dayOfWeek:
                          type: number
                      required:
                        - id
                        - email
                        - date
                        - datetime
                        - username
                        - userGrade
                        - userFamilyName
                        - userGivenName
                        - userId
                        - subject
                        - app
                        - courseId
                        - courseName
                        - campusId
                        - campusName
                        - enrollmentId
                        - activityId
                        - activityName
                        - totalQuestions
                        - correctQuestions
                        - masteredUnits
                        - activeSeconds
                        - inactiveSeconds
                        - wasteSeconds
                        - source
                        - alphaLevel
                        - generatedAt
                        - sendTime
                        - sensor
                        - eventType
                        - year
                        - month
                        - day
                        - dayOfWeek
                required:
                  - message
                  - startDate
                  - endDate
                  - facts
  /edubridge/analytics/highestGradeMastered/:studentId/:subject:
    get:
      operationId: getHighestGradeMastered
      summary: Gets the highest grade mastered by a student for a given subject
      description: >-
        Gets the highest grade mastered by a student for a given subject across
        different data sources (currently edulastic, placement and test out
        datasets)
      tags:
        - Analytics
      parameters:
        - in: path
          name: studentId
          description: >-
            The sourced_id of the student for which to get the highest grade
            mastered
          schema:
            type: string
            description: >-
              The sourced_id of the student for which to get the highest grade
              mastered
          required: true
        - in: path
          name: subject
          description: The subject for which to get the highest grade mastered
          schema:
            type: string
            description: The subject for which to get the highest grade mastered
          required: true
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  studentId:
                    type: string
                    description: >-
                      The sourced_id of the student for which to get the highest
                      grade mastered
                  subject:
                    type: string
                    description: The subject for which to get the highest grade mastered
                  grades:
                    type: object
                    properties:
                      ritGrade:
                        oneOf:
                          - $ref: '#/components/schemas/GradeEnum'
                          - type: 'null'
                      edulasticGrade:
                        oneOf:
                          - $ref: '#/components/schemas/GradeEnum'
                          - type: 'null'
                      placementGrade:
                        oneOf:
                          - $ref: '#/components/schemas/GradeEnum'
                          - type: 'null'
                      testOutGrade:
                        oneOf:
                          - $ref: '#/components/schemas/GradeEnum'
                          - type: 'null'
                      highestGradeOverall:
                        oneOf:
                          - $ref: '#/components/schemas/GradeEnum'
                          - type: 'null'
                    required:
                      - ritGrade
                      - edulasticGrade
                      - placementGrade
                      - testOutGrade
                      - highestGradeOverall
                required:
                  - studentId
                  - subject
                  - grades
  /edubridge/analytics/students/{studentId}/percentiles:
    get:
      operationId: getStudentPercentiles
      summary: Get latest MAP percentiles by subject for a student
      description: >-
        Returns the most recent MAP percentile and RIT score for each subject
        available for the student.
      tags:
        - Analytics
      parameters:
        - name: studentId
          description: The unique identifier for the student
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  percentiles:
                    type: array
                    items:
                      type: object
                      properties:
                        subject:
                          type: string
                          description: Subject of the MAP assessment
                        percentile:
                          type:
                            - integer
                            - 'null'
                          description: Latest achievement percentile for the subject
                        ritScore:
                          type: integer
                          description: Latest RIT score for the subject
                        assessmentDate:
                          type: string
                          format: date-time
                          description: ISO datetime of the MAP assessment
                        season:
                          type:
                            - string
                            - 'null'
                          description: MAP term/season metadata when available
                      required:
                        - subject
                        - percentile
                        - ritScore
                        - assessmentDate
                        - season
                required:
                  - percentiles
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedRequestResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ForbiddenResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Unprocessable Entity / Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TooManyRequestsResponse'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
  /edubridge/subject-track/:
    get:
      operationId: getSubjectTracks
      summary: Get all subject tracks
      description: >-
        List all subject tracks: the target course for each organization
        (school/campus), subject and grade level combination. Includes both
        organization-specific tracks and global tracks that apply to all
        organizations.
      tags:
        - Subject Track
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  subjectTrack:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                        grade:
                          $ref: '#/components/schemas/GradeEnum'
                        subject:
                          $ref: '#/components/schemas/SubjectEnum'
                        course:
                          type: object
                          properties:
                            sourcedId:
                              type: string
                              minLength: 1
                            status:
                              type: string
                              enum: *ref_13
                            dateLastModified:
                              type: string
                              format: date-time
                            metadata:
                              type: object
                              additionalProperties: true
                              nullable: true
                              description: Additional metadata for the object
                            title:
                              type: string
                            courseCode:
                              type:
                                - string
                                - 'null'
                            grades:
                              type:
                                - array
                                - 'null'
                              items:
                                allOf:
                                  - $ref: '#/components/schemas/GradeEnum'
                                description: The grades of the course
                                enum: *ref_14
                            subjects:
                              type:
                                - array
                                - 'null'
                              items:
                                allOf:
                                  - $ref: '#/components/schemas/SubjectEnum'
                                description: The subjects of the course
                                enum: *ref_11
                            subjectCodes:
                              type:
                                - array
                                - 'null'
                              items:
                                type: string
                            org:
                              type: object
                              properties:
                                sourcedId:
                                  type: string
                              required:
                                - sourcedId
                            level:
                              type:
                                - string
                                - 'null'
                            primaryApp:
                              type: string
                              description: >-
                                sourcedId of the application that owns this
                                course's content. Persisted to
                                courses.primary_app_sourced_id when it matches
                                an active application (resolved via direct match
                                → alias map → fuzzy match). Falls back to
                                metadata.primaryApp on input for back-compat.
                                Non-string values are ignored, matching pre-fix
                                behaviour where the field was an unknown key.
                          required:
                            - status
                            - title
                            - org
                          description: Represents a course.
                        org:
                          oneOf:
                            - $ref: '#/components/schemas/Org'
                            - type: 'null'
                      required:
                        - id
                        - grade
                        - subject
                        - course
                        - org
                required:
                  - subjectTrack
    put:
      operationId: putSubjectTrack
      summary: Create or update a subject track
      description: >-
        Creates a new subject track or updates an existing one for the given
        organization, subject and grade with upsert behavior. If orgSourcedId is
        provided, creates an organization-specific track. If omitted, creates a
        global track that applies to all organizations. There can be only one
        target course per organization, subject and grade level combination.
      tags:
        - Subject Track
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                subject:
                  $ref: '#/components/schemas/SubjectEnum'
                  description: The subject for the track (required)
                grade:
                  $ref: '#/components/schemas/GradeEnum'
                  description: The grade level for the track (required)
                courseId:
                  type: string
                  minLength: 1
                  description: The course ID to associate with this track (required)
                orgSourcedId:
                  type: string
                  description: >-
                    Optional organization/school ID. If not provided, creates a
                    global track that applies to all organizations
              required:
                - subject
                - grade
                - courseId
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  subjectTrack:
                    type: object
                    properties:
                      id:
                        type: string
                      grade:
                        $ref: '#/components/schemas/GradeEnum'
                      subject:
                        $ref: '#/components/schemas/SubjectEnum'
                      course:
                        type: object
                        properties:
                          sourcedId:
                            type: string
                            minLength: 1
                          status:
                            type: string
                            enum: *ref_13
                          dateLastModified:
                            type: string
                            format: date-time
                          metadata:
                            type: object
                            additionalProperties: true
                            nullable: true
                            description: Additional metadata for the object
                          title:
                            type: string
                          courseCode:
                            type:
                              - string
                              - 'null'
                          grades:
                            type:
                              - array
                              - 'null'
                            items:
                              allOf:
                                - $ref: '#/components/schemas/GradeEnum'
                              description: The grades of the course
                              enum: *ref_14
                          subjects:
                            type:
                              - array
                              - 'null'
                            items:
                              allOf:
                                - $ref: '#/components/schemas/SubjectEnum'
                              description: The subjects of the course
                              enum: *ref_11
                          subjectCodes:
                            type:
                              - array
                              - 'null'
                            items:
                              type: string
                          org:
                            type: object
                            properties:
                              sourcedId:
                                type: string
                            required:
                              - sourcedId
                          level:
                            type:
                              - string
                              - 'null'
                          primaryApp:
                            type: string
                            description: >-
                              sourcedId of the application that owns this
                              course's content. Persisted to
                              courses.primary_app_sourced_id when it matches an
                              active application (resolved via direct match →
                              alias map → fuzzy match). Falls back to
                              metadata.primaryApp on input for back-compat.
                              Non-string values are ignored, matching pre-fix
                              behaviour where the field was an unknown key.
                        required:
                          - status
                          - title
                          - org
                        description: Represents a course.
                      org:
                        oneOf:
                          - $ref: '#/components/schemas/Org'
                          - type: 'null'
                    required:
                      - id
                      - grade
                      - subject
                      - course
                      - org
                required:
                  - subjectTrack
  /edubridge/subject-track/{id}:
    delete:
      operationId: deleteSubjectTrack
      summary: Delete a subject track
      description: Deletes a subject track by its ID
      tags:
        - Subject Track
      parameters:
        - name: id
          description: The ID of the subject track to delete
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Subject track deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: 'null'
                required:
                  - data
  /edubridge/subject-track/groups:
    get:
      operationId: listSubjectTrackGroups
      summary: List all subject track groups
      description: >-
        Returns all subject tracks organized into logical groups. Groups are
        defined by subject, grade, course, and type (global vs campus-specific).
        Global groups contain a single track that applies to all organizations.
        Campus groups contain multiple tracks for specific organizations sharing
        the same subject, grade, and course.
      tags:
        - Subject Track
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  groups:
                    type: array
                    items:
                      type: object
                      properties:
                        key:
                          type: object
                          properties:
                            subject:
                              $ref: '#/components/schemas/SubjectEnum'
                            grade:
                              $ref: '#/components/schemas/GradeEnum'
                            courseId:
                              type: string
                            isGlobal:
                              type: boolean
                          required:
                            - subject
                            - grade
                            - courseId
                            - isGlobal
                        tracks:
                          type: array
                          items:
                            type: object
                            properties:
                              id:
                                type: string
                              grade:
                                $ref: '#/components/schemas/GradeEnum'
                              subject:
                                $ref: '#/components/schemas/SubjectEnum'
                              course:
                                type: object
                                properties:
                                  sourcedId:
                                    type: string
                                    minLength: 1
                                  status:
                                    type: string
                                    enum: *ref_13
                                  dateLastModified:
                                    type: string
                                    format: date-time
                                  metadata:
                                    type: object
                                    additionalProperties: true
                                    nullable: true
                                    description: Additional metadata for the object
                                  title:
                                    type: string
                                  courseCode:
                                    type:
                                      - string
                                      - 'null'
                                  grades:
                                    type:
                                      - array
                                      - 'null'
                                    items:
                                      allOf:
                                        - $ref: '#/components/schemas/GradeEnum'
                                      description: The grades of the course
                                      enum: *ref_14
                                  subjects:
                                    type:
                                      - array
                                      - 'null'
                                    items:
                                      allOf:
                                        - $ref: '#/components/schemas/SubjectEnum'
                                      description: The subjects of the course
                                      enum: *ref_11
                                  subjectCodes:
                                    type:
                                      - array
                                      - 'null'
                                    items:
                                      type: string
                                  org:
                                    type: object
                                    properties:
                                      sourcedId:
                                        type: string
                                    required:
                                      - sourcedId
                                  level:
                                    type:
                                      - string
                                      - 'null'
                                  primaryApp:
                                    type: string
                                    description: >-
                                      sourcedId of the application that owns
                                      this course's content. Persisted to
                                      courses.primary_app_sourced_id when it
                                      matches an active application (resolved
                                      via direct match → alias map → fuzzy
                                      match). Falls back to metadata.primaryApp
                                      on input for back-compat. Non-string
                                      values are ignored, matching pre-fix
                                      behaviour where the field was an unknown
                                      key.
                                required:
                                  - status
                                  - title
                                  - org
                                description: Represents a course.
                              org:
                                oneOf:
                                  - $ref: '#/components/schemas/Org'
                                  - type: 'null'
                            required:
                              - id
                              - grade
                              - subject
                              - course
                              - org
                      required:
                        - key
                        - tracks
                required:
                  - groups
    post:
      operationId: createSubjectTrackGroup
      summary: Create a subject track group
      description: >-
        Creates a new subject track group. If orgSourcedIds is empty, creates a
        global track that applies to all organizations. If orgSourcedIds
        contains organization IDs, creates campus-specific tracks for each
        organization. All tracks in the group will have the same subject, grade,
        and course.
      tags:
        - Subject Track
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                subject:
                  $ref: '#/components/schemas/SubjectEnum'
                  description: The subject for the track group (required)
                grade:
                  $ref: '#/components/schemas/GradeEnum'
                  description: The grade level for the track group (required)
                courseId:
                  type: string
                  minLength: 1
                  description: >-
                    The course ID to associate with all tracks in this group
                    (required)
                orgSourcedIds:
                  type: array
                  items:
                    type: string
                  default: []
                  description: >-
                    Array of organization IDs for campus-specific tracks. Empty
                    array creates a global track that applies to all
                    organizations
              required:
                - subject
                - grade
                - courseId
      responses:
        '204':
          description: Group created successfully
          content: {}
    put:
      operationId: updateSubjectTrackGroup
      summary: Update a subject track group
      description: >-
        Updates an existing subject track group by replacing all tracks in the
        group. The group is identified by subject, grade, currentCourseId, and
        isGlobal. All existing tracks in the group will be deleted and new
        tracks created with the specified configuration. Supports changing the
        course and organization list for the group.
      tags:
        - Subject Track
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                subject:
                  $ref: '#/components/schemas/SubjectEnum'
                  description: The subject for the track group (required)
                grade:
                  $ref: '#/components/schemas/GradeEnum'
                  description: The grade level for the track group (required)
                currentCourseId:
                  type: string
                  minLength: 1
                  description: The current course ID to identify the existing group
                courseId:
                  type: string
                  minLength: 1
                  description: The new course ID to associate with all tracks in this group
                isGlobal:
                  type: boolean
                  description: >-
                    Whether this is a global group (true) or campus group
                    (false)
                orgSourcedIds:
                  type: array
                  items:
                    type: string
                  default: []
                  description: >-
                    Array of organization IDs for the updated group. Empty array
                    converts to global track
                strategy:
                  type: string
                  enum:
                    - replace
                    - fail
                  default: replace
                  description: >-
                    Conflict resolution strategy: replace existing tracks or
                    fail on conflicts
              required:
                - subject
                - grade
                - currentCourseId
                - courseId
                - isGlobal
      responses:
        '204':
          description: Group updated successfully
          content: {}
    delete:
      operationId: deleteSubjectTrackGroup
      summary: Delete a subject track group
      description: >-
        Deletes all subject tracks in a group. The group is identified by
        subject, grade, courseId, and isGlobal. All tracks belonging to this
        group will be permanently removed.
      tags:
        - Subject Track
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                subject:
                  $ref: '#/components/schemas/SubjectEnum'
                  description: The subject for the track group (required)
                grade:
                  $ref: '#/components/schemas/GradeEnum'
                  description: The grade level for the track group (required)
                courseId:
                  type: string
                  minLength: 1
                  description: The course ID to identify the group to delete
                isGlobal:
                  type: boolean
                  description: >-
                    Whether this is a global group (true) or campus group
                    (false)
              required:
                - subject
                - grade
                - courseId
                - isGlobal
      responses:
        '204':
          description: Group deleted successfully
          content: {}
  /edubridge/applications/:
    get:
      operationId: getApplications
      summary: Get all applications
      description: List all applications available in the system
      tags:
        - Applications
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  applications:
                    type: array
                    items:
                      type: object
                      properties:
                        sourcedId:
                          type: string
                        name:
                          type: string
                        description:
                          type:
                            - string
                            - 'null'
                        domain:
                          type: array
                          items:
                            type: string
                        tenantId:
                          type:
                            - string
                            - 'null'
                        clientAppId:
                          type:
                            - string
                            - 'null'
                        status:
                          type: string
                        dateLastModified:
                          type: string
                        metadata:
                          type: 'null'
                      required:
                        - sourcedId
                        - name
                        - description
                        - domain
                        - tenantId
                        - clientAppId
                        - status
                        - dateLastModified
                required:
                  - applications
  /edubridge/applicationMetrics/{applicationSourcedId}:
    get:
      operationId: getApplicationMetrics
      summary: Get all metrics for an application
      description: >

        Returns all application metrics for a given application.


        This endpoint provides a way to retrieve all tracked metrics associated
        with an application,

        including the metric type and source information.
      tags:
        - Application Metrics
      parameters:
        - name: applicationSourcedId
          description: The unique identifier for the application
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        applicationSourcedId:
                          type: string
                          description: The application sourced id
                        metric:
                          type: string
                          enum: &ref_15
                            - xp
                            - spent_minutes
                            - waste_minutes
                            - accuracy
                            - lessons
                            - quizzes
                            - unit_tests
                          description: The metric
                        metricSource:
                          type: string
                          enum: &ref_16
                            - timeback_app
                            - timeback_direct_integration
                            - timeback_adapter
                            - powerpath
                            - manual_entry
                          description: The metric source
                      required:
                        - applicationSourcedId
                        - metric
                        - metricSource
                required:
                  - data
    post:
      operationId: createApplicationMetric
      summary: Create a new application metric
      description: >

        Creates a new application metric for tracking.


        This endpoint allows you to record metrics associated with an
        application,

        specifying the metric type and source for proper categorization.
      tags:
        - Application Metrics
      parameters:
        - name: applicationSourcedId
          description: The unique identifier for the application
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                applicationMetric:
                  type: object
                  properties:
                    metric:
                      type: string
                      enum: *ref_15
                      description: The metric
                    metricSource:
                      type: string
                      enum: *ref_16
                      description: The metric source
                  required:
                    - metric
                    - metricSource
              required:
                - applicationMetric
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      applicationSourcedId:
                        type: string
                        description: The application sourced id
                      metric:
                        type: string
                        enum: *ref_15
                        description: The metric
                      metricSource:
                        type: string
                        enum: *ref_16
                        description: The metric source
                    required:
                      - applicationSourcedId
                      - metric
                      - metricSource
                required:
                  - data
    delete:
      operationId: deleteApplicationMetric
      summary: Delete an application metric
      description: >

        Deletes a specific application metric.


        This endpoint removes a specific metric record identified by the
        application ID,

        metric type, and metric source.
      tags:
        - Application Metrics
      parameters:
        - name: applicationSourcedId
          description: The unique identifier for the application
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                applicationMetric:
                  type: object
                  properties:
                    metric:
                      type: string
                      enum: *ref_15
                      description: The metric
                    metricSource:
                      type: string
                      enum: *ref_16
                      description: The metric source
                  required:
                    - metric
                    - metricSource
              required:
                - applicationMetric
      responses:
        '204':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: 'null'
                required:
                  - data
  /edubridge/enrollments/defaultClass/{courseId}/{schoolId}?:
    get:
      operationId: getDefaultCourseClass
      summary: Get the default class for a course
      description: >

        Retrieves and automatically creates a default class (and other necessary
        academic entities) for the specified course. 


        This endpoint simplifies the management of digital learning by
        abstracting away the need to manually create class structures. 


        For digital-only courses, this endpoint ensures that the necessary
        academic structure (school year, term, class) exists 

        without requiring the consumer to understand or manage this complex
        hierarchy.

        The class is created with appropriate digital-friendly settings.


        You do not need to call this endpoint unless you have a use case where
        you want to manage the underlying academic structure (school year, term,
        class) for a course.
      tags:
        - Enrollments
      parameters:
        - name: courseId
          description: The unique identifier for the course
          in: path
          required: true
          schema:
            type: string
        - name: schoolId
          description: The unique identifier for the school
          in: path
          required: false
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        example: '123'
                      title:
                        type: string
                      classCode:
                        type:
                          - string
                          - 'null'
                      subjectCodes:
                        type: array
                        items:
                          type: string
                      subjects:
                        type: array
                        items:
                          allOf:
                            - $ref: '#/components/schemas/SubjectEnum'
                          description: The subjects of the course
                          enum: *ref_11
                      grades:
                        type: array
                        items:
                          allOf:
                            - $ref: '#/components/schemas/GradeEnum'
                          description: The grades of the course
                          enum: *ref_14
                      periods:
                        type: array
                        items:
                          type: string
                      course:
                        type: object
                        properties:
                          id:
                            type: string
                          title:
                            type: string
                          metadata:
                            type: object
                            additionalProperties: {}
                          subjects:
                            type:
                              - array
                              - 'null'
                            items:
                              type: string
                          grades:
                            type:
                              - array
                              - 'null'
                            items:
                              type: string
                          primaryApp:
                            type:
                              - object
                              - 'null'
                            properties:
                              id:
                                type: string
                              name:
                                type: string
                              domains:
                                type: array
                                items:
                                  type: string
                            required:
                              - id
                              - name
                              - domains
                        required:
                          - id
                          - title
                          - metadata
                    required:
                      - id
                      - title
                      - classCode
                      - subjectCodes
                      - subjects
                      - grades
                      - periods
                      - course
                required:
                  - data
  /edubridge/enrollments/enroll/{userId}/{courseId}/{schoolId}?:
    post:
      operationId: enrollUserInCourse
      summary: Enroll user in a course
      description: >

        Enrolls a user in a course with a single API call. 


        This endpoint handles all necessary background operations: locating or
        creating a default class for the course, 

        establishing appropriate academic sessions (school year and term), and
        creating the enrollment record. 


        Consumers can simply specify the user, course, and role (default is
        'student') without 

        needing to understand or manage the underlying academic structure that
        OneRoster requires.
      tags:
        - Enrollments
      parameters:
        - name: userId
          description: The unique identifier for the user
          in: path
          required: true
          schema:
            type: string
        - name: courseId
          description: The unique identifier for the course
          in: path
          required: true
          schema:
            type: string
        - name: schoolId
          description: The unique identifier for the school
          in: path
          required: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                sourcedId:
                  type: string
                  description: Optional client-provided ID for the enrollment
                role:
                  type: string
                  enum: &ref_17
                    - administrator
                    - proctor
                    - student
                    - teacher
                  default: student
                beginDate:
                  type: string
                  format: date-time
                  description: >-
                    The date the user is enrolled in the course, defaults to
                    today
                metadata:
                  type: object
                  properties:
                    goals:
                      type: object
                      properties:
                        dailyXp:
                          type: number
                        dailyLessons:
                          type: number
                        dailyActiveMinutes:
                          type: number
                        dailyAccuracy:
                          type: number
                        dailyMasteredUnits:
                          type: number
                      additionalProperties: false
                    metrics:
                      type: object
                      properties:
                        totalXp:
                          type: number
                        totalLessons:
                          type: number
                        totalGrades:
                          type: number
                          description: Total number of grade levels covered by this course
                        courseType:
                          type: string
                          description: >-
                            The type of course (e.g. 'optional', 'hole-filling',
                            'base')
                        isSupplemental:
                          type: boolean
                          description: Indicates whether the course is supplemental content
                      additionalProperties: false
                  additionalProperties: true
              additionalProperties: false
      responses:
        '201':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      id:
                        type: string
                        example: '123'
                      role:
                        type: string
                        enum: *ref_17
                      beginDate:
                        type:
                          - string
                          - 'null'
                      endDate:
                        type:
                          - string
                          - 'null'
                      metadata:
                        type: object
                        properties:
                          goals:
                            type: object
                            properties:
                              dailyXp:
                                type: number
                              dailyLessons:
                                type: number
                              dailyActiveMinutes:
                                type: number
                              dailyAccuracy:
                                type: number
                              dailyMasteredUnits:
                                type: number
                            additionalProperties: false
                          metrics:
                            type: object
                            properties:
                              totalXp:
                                type: number
                              totalLessons:
                                type: number
                              totalGrades:
                                type: number
                                description: >-
                                  Total number of grade levels covered by this
                                  course
                              courseType:
                                type: string
                                description: >-
                                  The type of course (e.g. 'optional',
                                  'hole-filling', 'base')
                              isSupplemental:
                                type: boolean
                                description: >-
                                  Indicates whether the course is supplemental
                                  content
                            additionalProperties: false
                        additionalProperties: true
                      course:
                        type: object
                        properties:
                          id:
                            type: string
                          title:
                            type: string
                          metadata:
                            type: object
                            additionalProperties: {}
                          subjects:
                            type:
                              - array
                              - 'null'
                            items:
                              type: string
                          grades:
                            type:
                              - array
                              - 'null'
                            items:
                              type: string
                          primaryApp:
                            type:
                              - object
                              - 'null'
                            properties:
                              id:
                                type: string
                              name:
                                type: string
                              domains:
                                type: array
                                items:
                                  type: string
                            required:
                              - id
                              - name
                              - domains
                        required:
                          - id
                          - title
                          - metadata
                      school:
                        type: object
                        properties:
                          id:
                            type: string
                          name:
                            type: string
                        required:
                          - id
                          - name
                      testOutSupported:
                        type: boolean
                        description: >-
                          Whether the course has at least one subject that
                          supports self-elected test-out assessments
                      testOutEligible:
                        type: boolean
                        description: >-
                          Whether the student is currently eligible to request a
                          test-out for this enrollment. Always false when
                          testOutSupported is false.
                    required:
                      - id
                      - role
                      - beginDate
                      - endDate
                      - course
                      - school
                      - testOutSupported
                      - testOutEligible
                required:
                  - data
  /edubridge/enrollments/resetGoals/{courseId}:
    post:
      operationId: resetEnrollmentGoals
      summary: Reset enrollment goals to current course goals
      description: >-
        Resets the goals for all enrollments in a course to the course's current
        goals.
      tags:
        - Enrollments
      parameters:
        - name: courseId
          description: The unique identifier for the course
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Goals successfully reset
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      updated:
                        type: number
                        description: Number of enrollments successfully updated
                      errors:
                        type: array
                        items:
                          type: string
                        description: List of errors encountered during propagation
                    required:
                      - updated
                      - errors
                required:
                  - data
        '404':
          description: Course not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Course has no goals defined
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnprocessableEntityResponse'
  /edubridge/enrollments/resetProgress/{userId}/{courseId}:
    delete:
      operationId: resetUserCourseProgress
      summary: Resets an user's progress in a given course
      description: >

        Reset the progress an user has made in a given course.


        This endpoint finds all assessment results to associated a given course
        and user and marks them as 'tobedeleted'. 


        This endpoint is not responsible for deleting results and progress in
        third party apps.
      tags:
        - Enrollments
      parameters:
        - name: userId
          description: The unique identifier for the user
          in: path
          required: true
          schema:
            type: string
        - name: courseId
          description: The unique identifier for the course
          in: path
          required: true
          schema:
            type: string
      responses:
        '204':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: 'null'
                required:
                  - data
  /edubridge/enrollments/unenroll/{userId}/{courseId}/{schoolId}?:
    delete:
      operationId: unenrollUserFromCourse
      summary: Unenroll a user from a course
      description: >

        Unenrolls a user from a course with a single API call. 


        This endpoint automatically handles finding the appropriate class
        enrollment(s) for the course and marking them as 'tobedeleted'. 


        Consumers don't need to know which specific class the user is enrolled
        in or manage the enrollment status transitions required by OneRoster.
      tags:
        - Enrollments
      parameters:
        - name: userId
          description: The unique identifier for the user
          in: path
          required: true
          schema:
            type: string
        - name: courseId
          description: The unique identifier for the course
          in: path
          required: true
          schema:
            type: string
        - name: schoolId
          description: The unique identifier for the school
          in: path
          required: false
          schema:
            type: string
      responses:
        '204':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: 'null'
                required:
                  - data
  /edubridge/enrollments/user/{userId}:
    get:
      operationId: getUserEnrollments
      summary: Get all active enrollments for a user
      description: >

        Returns a simplified, course-centric view of all active enrollments for
        a user. 


        This endpoint abstracts away the complex OneRoster academic hierarchy, 

        providing a streamlined representation that focuses on what courses the
        user is enrolled in rather than details about classes, sections, and
        academic sessions.


        The response includes essential course information without the need to
        navigate multiple relationship levels.
      tags:
        - Enrollments
      parameters:
        - name: userId
          description: The unique identifier for the user
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          example: '123'
                        role:
                          type: string
                          enum: *ref_17
                        beginDate:
                          type:
                            - string
                            - 'null'
                        endDate:
                          type:
                            - string
                            - 'null'
                        metadata:
                          type: object
                          properties:
                            goals:
                              type: object
                              properties:
                                dailyXp:
                                  type: number
                                dailyLessons:
                                  type: number
                                dailyActiveMinutes:
                                  type: number
                                dailyAccuracy:
                                  type: number
                                dailyMasteredUnits:
                                  type: number
                              additionalProperties: false
                            metrics:
                              type: object
                              properties:
                                totalXp:
                                  type: number
                                totalLessons:
                                  type: number
                                totalGrades:
                                  type: number
                                  description: >-
                                    Total number of grade levels covered by this
                                    course
                                courseType:
                                  type: string
                                  description: >-
                                    The type of course (e.g. 'optional',
                                    'hole-filling', 'base')
                                isSupplemental:
                                  type: boolean
                                  description: >-
                                    Indicates whether the course is supplemental
                                    content
                              additionalProperties: false
                          additionalProperties: true
                        course:
                          type: object
                          properties:
                            id:
                              type: string
                            title:
                              type: string
                            metadata:
                              type: object
                              additionalProperties: {}
                            subjects:
                              type:
                                - array
                                - 'null'
                              items:
                                type: string
                            grades:
                              type:
                                - array
                                - 'null'
                              items:
                                type: string
                            primaryApp:
                              type:
                                - object
                                - 'null'
                              properties:
                                id:
                                  type: string
                                name:
                                  type: string
                                domains:
                                  type: array
                                  items:
                                    type: string
                              required:
                                - id
                                - name
                                - domains
                          required:
                            - id
                            - title
                            - metadata
                        school:
                          type: object
                          properties:
                            id:
                              type: string
                            name:
                              type: string
                          required:
                            - id
                            - name
                        testOutSupported:
                          type: boolean
                          description: >-
                            Whether the course has at least one subject that
                            supports self-elected test-out assessments
                        testOutEligible:
                          type: boolean
                          description: >-
                            Whether the student is currently eligible to request
                            a test-out for this enrollment. Always false when
                            testOutSupported is false.
                      required:
                        - id
                        - role
                        - beginDate
                        - endDate
                        - course
                        - school
                        - testOutSupported
                        - testOutEligible
                required:
                  - data
  /edubridge/time-saved/user/{userId}:
    get:
      operationId: getStudentTimeSaved
      summary: Get total time saved for a student this school year
      description: >

        Calculates the total time a student has "got back" during the current
        school year.


        This endpoint compares the personalized learning system's efficient
        2-hour daily study time against 

        traditional school schedules (6 hours class + 1 hour homework = 7 hours
        total), 

        resulting in 5 hours saved per school day.


        The calculation starts from the student's earliest valid enrollment date
        within the current school year 

        (or the school year start date if they enrolled earlier) and counts only
        actual school days 

        (excluding weekends, holidays, breaks, and MAP testing days).


        **Formula:** Number of school days elapsed × 5 hours saved per day =
        Total hours saved


        The response includes both the total hours saved and equivalent full
        days saved (hours ÷ 24).
      tags:
        - Enrollments
      parameters:
        - name: userId
          description: The unique identifier for the student
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: object
                    properties:
                      totalHoursSaved:
                        type: number
                        example: 600
                        description: Total hours saved during the current school year
                      totalDaysSaved:
                        type: number
                        example: 25
                        description: Total full days saved (totalHoursSaved / 24)
                      schoolDaysElapsed:
                        type: number
                        example: 120
                        description: >-
                          Number of school days elapsed since earliest
                          enrollment
                      earliestStartDate:
                        type: string
                        format: date-time
                        example: 2024-08-25T00:00:00.000Z
                        description: >-
                          Earliest valid enrollment date for the student or
                          school year start date
                      schoolYearStartDate:
                        type: string
                        format: date-time
                        example: 2024-08-15T00:00:00.000Z
                        description: Start date of the current school year
                      calculation:
                        type: object
                        properties:
                          standardSchoolHoursPerDay:
                            type: number
                            example: 7
                            description: >-
                              Standard school hours per day (6 hours class + 1
                              hour homework)
                          timebackHoursPerDay:
                            type: number
                            example: 2
                            description: Personalized learning hours per day
                          hoursSavedPerDay:
                            type: number
                            example: 5
                            description: >-
                              Hours saved per day (standard - personalized
                              learning)
                          formula:
                            type: string
                            example: >-
                              120 school days × 5 hours saved per day = 600
                              hours
                            description: Human-readable calculation formula
                        required:
                          - standardSchoolHoursPerDay
                          - timebackHoursPerDay
                          - hoursSavedPerDay
                          - formula
                    required:
                      - totalHoursSaved
                      - totalDaysSaved
                      - schoolDaysElapsed
                      - earliestStartDate
                      - schoolYearStartDate
                      - calculation
                    description: >-
                      Time saved calculation for the student during the current
                      school year
                required:
                  - data
        '404':
          description: Student not found or no enrollments found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
components:
  securitySchemes:
    MCP:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: >-
            https://prod-beyond-timeback-api-2-idp.auth.us-east-1.amazoncognito.com/oauth2/authorize
          tokenUrl: >-
            https://prod-beyond-timeback-api-2-idp.auth.us-east-1.amazoncognito.com/oauth2/token
          scopes:
            https://purl.imsglobal.org/spec/or/v1p1/scope/roster-core.readonly: Read access to roster core
            https://purl.imsglobal.org/spec/or/v1p1/scope/roster.readonly: Read access to roster
            https://purl.imsglobal.org/spec/or/v1p1/scope/roster-demographics.readonly: Read access to roster demographics
            https://purl.imsglobal.org/spec/or/v1p1/scope/resource.readonly: Read access to resource
            https://purl.imsglobal.org/spec/or/v1p1/scope/gradebook.readonly: Read access to gradebook
            https://purl.imsglobal.org/spec/powerpath/v1p1/scope/powerpath.readonly: Read access to powerpath
            https://purl.imsglobal.org/spec/ob/v3p0/scope/credential.readonly: Read your issued badges
            https://purl.imsglobal.org/spec/clr/v2p0/scope/credential.readonly: Read access to CLR
    OAuth2:
      type: oauth2
      flows:
        clientCredentials:
          scopes:
            https://purl.imsglobal.org/spec/or/v1p1/scope/admin: Admin access to the API
            https://purl.imsglobal.org/spec/or/v1p2/scope/admin.own: Admin access restricted to own resources
            https://purl.imsglobal.org/spec/or/v1p1/scope/roster-core.readonly: Read access to roster core
            https://purl.imsglobal.org/spec/or/v1p1/scope/roster.readonly: Read access to roster
            https://purl.imsglobal.org/spec/or/v1p1/scope/roster.createput: Create and update access to roster
            https://purl.imsglobal.org/spec/or/v1p1/scope/roster.delete: Delete access to roster
            https://purl.imsglobal.org/spec/or/v1p1/scope/roster-demographics.readonly: Read access to roster demographics
            https://purl.imsglobal.org/spec/or/v1p1/scope/roster-demographics.createput: Create and update access to roster demographics
            https://purl.imsglobal.org/spec/or/v1p1/scope/roster-demographics.delete: Delete access to roster demographics
            https://purl.imsglobal.org/spec/or/v1p1/scope/resource.readonly: Read access to resource
            https://purl.imsglobal.org/spec/or/v1p1/scope/resource.createput: Create and update access to resource
            https://purl.imsglobal.org/spec/or/v1p1/scope/resource.delete: Delete access to resource
            https://purl.imsglobal.org/spec/or/v1p1/scope/gradebook.readonly: Read access to gradebook
            https://purl.imsglobal.org/spec/or/v1p1/scope/gradebook.createput: Create and update access to gradebook
            https://purl.imsglobal.org/spec/or/v1p1/scope/gradebook.delete: Delete access to gradebook
            https://purl.imsglobal.org/spec/powerpath/v1p1/scope/powerpath.readonly: Read access to powerpath
            https://purl.imsglobal.org/spec/powerpath/v1p1/scope/powerpath.createput: Create and update access to powerpath
            https://purl.imsglobal.org/spec/powerpath/v1p1/scope/powerpath.delete: Delete access to powerpath
            https://purl.imsglobal.org/spec/powerpath/v1p1/scope/powerpath.admin: Admin access to powerpath
            https://purl.imsglobal.org/spec/ob/v3p0/scope/credential.readonly: Read your issued badges
            https://purl.imsglobal.org/spec/ob/v3p0/scope/credential.upsert: Store new badges in your account
            https://purl.imsglobal.org/spec/ob/v3p0/scope/credential.delete: Delete access to open badges
            https://purl.imsglobal.org/spec/ob/v3p0/scope/credential.admin: Administrative access to open badges
            https://purl.imsglobal.org/spec/clr/v2p0/scope/credential.readonly: Read access to CLR
            https://purl.imsglobal.org/spec/clr/v2p0/scope/credential.upsert: Create and update access to CLR
            https://purl.imsglobal.org/spec/clr/v2p0/scope/credential.admin: Administrative access to CLR
            https://api.alpha-1edtech.ai/edubridge/progression.readonly: Browse lesson catalog via progression proxy
            https://api.alpha-1edtech.ai/edubridge/progression.createput: Create hole-filling courses via progression proxy
          tokenUrl: >-
            https://prod-beyond-timeback-api-2-idp.auth.us-east-1.amazoncognito.com/oauth2/token
  schemas:
    BadRequestResponse:
      type: object
      properties:
        imsx_codeMajor:
          type: string
          default: failure
          description: The major response code
          example: failure
        imsx_severity:
          type: string
          default: error
          description: The severity of the response
          example: error
        imsx_description:
          type: string
        imsx_CodeMinor:
          type: object
          properties:
            imsx_codeMinorField:
              type: array
              items:
                type: object
                properties:
                  imsx_codeMinorFieldName:
                    type: string
                    default: TargetEndSystem
                    description: The field name for the minor code
                    example: TargetEndSystem
                  imsx_codeMinorFieldValue:
                    type: string
                    default: invaliddata
                    description: The field value for the minor code
                    example: invaliddata
                required:
                  - imsx_codeMinorFieldName
                  - imsx_codeMinorFieldValue
          required:
            - imsx_codeMinorField
        imsx_error_details:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
      required:
        - imsx_codeMajor
        - imsx_severity
        - imsx_description
        - imsx_CodeMinor
    UnauthorizedRequestResponse:
      type: object
      properties:
        imsx_codeMajor:
          type: string
          default: failure
          description: The major response code
          example: failure
        imsx_severity:
          type: string
          default: error
          description: The severity of the response
          example: error
        imsx_description:
          type: string
        imsx_CodeMinor:
          type: object
          properties:
            imsx_codeMinorField:
              type: array
              items:
                type: object
                properties:
                  imsx_codeMinorFieldName:
                    type: string
                    default: TargetEndSystem
                    description: The field name for the minor code
                    example: TargetEndSystem
                  imsx_codeMinorFieldValue:
                    type: string
                    default: unauthorisedrequest
                    description: The field value for the minor code
                    example: unauthorisedrequest
                required:
                  - imsx_codeMinorFieldName
                  - imsx_codeMinorFieldValue
          required:
            - imsx_codeMinorField
        imsx_error_details:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
      required:
        - imsx_codeMajor
        - imsx_severity
        - imsx_description
        - imsx_CodeMinor
    ForbiddenResponse:
      type: object
      properties:
        imsx_codeMajor:
          type: string
          default: failure
          description: The major response code
          example: failure
        imsx_severity:
          type: string
          default: error
          description: The severity of the response
          example: error
        imsx_description:
          type: string
        imsx_CodeMinor:
          type: object
          properties:
            imsx_codeMinorField:
              type: array
              items:
                type: object
                properties:
                  imsx_codeMinorFieldName:
                    type: string
                    default: TargetEndSystem
                    description: The field name for the minor code
                    example: TargetEndSystem
                  imsx_codeMinorFieldValue:
                    type: string
                    default: forbidden
                    description: The field value for the minor code
                    example: forbidden
                required:
                  - imsx_codeMinorFieldName
                  - imsx_codeMinorFieldValue
          required:
            - imsx_codeMinorField
        imsx_error_details:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
      required:
        - imsx_codeMajor
        - imsx_severity
        - imsx_description
        - imsx_CodeMinor
    NotFoundResponse:
      type: object
      properties:
        imsx_codeMajor:
          type: string
          default: failure
          description: The major response code
          example: failure
        imsx_severity:
          type: string
          default: error
          description: The severity of the response
          example: error
        imsx_description:
          type: string
        imsx_CodeMinor:
          type: object
          properties:
            imsx_codeMinorField:
              type: array
              items:
                type: object
                properties:
                  imsx_codeMinorFieldName:
                    type: string
                    default: TargetEndSystem
                    description: The field name for the minor code
                    example: TargetEndSystem
                  imsx_codeMinorFieldValue:
                    type: string
                    default: unknownobject
                    description: The field value for the minor code
                    example: unknownobject
                required:
                  - imsx_codeMinorFieldName
                  - imsx_codeMinorFieldValue
          required:
            - imsx_codeMinorField
        imsx_error_details:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
      required:
        - imsx_codeMajor
        - imsx_severity
        - imsx_description
        - imsx_CodeMinor
    UnprocessableEntityResponse:
      type: object
      properties:
        imsx_codeMajor:
          type: string
          default: failure
          description: The major response code
          example: failure
        imsx_severity:
          type: string
          default: error
          description: The severity of the response
          example: error
        imsx_description:
          type: string
        imsx_CodeMinor:
          type: object
          properties:
            imsx_codeMinorField:
              type: array
              items:
                type: object
                properties:
                  imsx_codeMinorFieldName:
                    type: string
                    default: TargetEndSystem
                    description: The field name for the minor code
                    example: TargetEndSystem
                  imsx_codeMinorFieldValue:
                    type: string
                    default: invaliddata
                    description: The field value for the minor code
                    example: invaliddata
                required:
                  - imsx_codeMinorFieldName
                  - imsx_codeMinorFieldValue
          required:
            - imsx_codeMinorField
        imsx_error_details:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
      required:
        - imsx_codeMajor
        - imsx_severity
        - imsx_description
        - imsx_CodeMinor
    TooManyRequestsResponse:
      type: object
      properties:
        imsx_codeMajor:
          type: string
          default: failure
          description: The major response code
          example: failure
        imsx_severity:
          type: string
          default: error
          description: The severity of the response
          example: error
        imsx_description:
          type: string
        imsx_CodeMinor:
          type: object
          properties:
            imsx_codeMinorField:
              type: array
              items:
                type: object
                properties:
                  imsx_codeMinorFieldName:
                    type: string
                    default: TargetEndSystem
                    description: The field name for the minor code
                    example: TargetEndSystem
                  imsx_codeMinorFieldValue:
                    type: string
                    default: server_busy
                    description: The field value for the minor code
                    example: server_busy
                required:
                  - imsx_codeMinorFieldName
                  - imsx_codeMinorFieldValue
          required:
            - imsx_codeMinorField
        imsx_error_details:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
      required:
        - imsx_codeMajor
        - imsx_severity
        - imsx_description
        - imsx_CodeMinor
    InternalServerErrorResponse:
      type: object
      properties:
        imsx_codeMajor:
          type: string
          default: failure
          description: The major response code
          example: failure
        imsx_severity:
          type: string
          default: error
          description: The severity of the response
          example: error
        imsx_description:
          type: string
        imsx_CodeMinor:
          type: object
          properties:
            imsx_codeMinorField:
              type: array
              items:
                type: object
                properties:
                  imsx_codeMinorFieldName:
                    type: string
                    default: TargetEndSystem
                    description: The field name for the minor code
                    example: TargetEndSystem
                  imsx_codeMinorFieldValue:
                    type: string
                    default: internal_server_error
                    description: The field value for the minor code
                    example: internal_server_error
                required:
                  - imsx_codeMinorFieldName
                  - imsx_codeMinorFieldValue
          required:
            - imsx_codeMinorField
        imsx_error_details:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
      required:
        - imsx_codeMajor
        - imsx_severity
        - imsx_description
        - imsx_CodeMinor
    GradeEnum:
      type: string
      enum: *ref_14
      description: >-
        Grade levels. -1 is Pre-K, 0 is Kindergarten, 1-12 are grades 1-12, 13
        is AP.
      example: '3'
    Demographics:
      type: object
      properties:
        sourcedId:
          type: string
        status:
          type: string
          enum: *ref_13
        dateLastModified:
          type: string
          format: date-time
        metadata:
          type: object
          additionalProperties: true
          nullable: true
          description: Additional metadata for the object
        birthDate:
          type:
            - string
            - 'null'
          pattern: ^\d{4}-\d{2}-\d{2}$
        sex:
          type:
            - string
            - 'null'
          enum:
            - male
            - female
            - other
            - unspecified
            - null
        americanIndianOrAlaskaNative:
          type:
            - string
            - 'null'
        asian:
          type:
            - string
            - 'null'
        blackOrAfricanAmerican:
          type:
            - string
            - 'null'
        nativeHawaiianOrOtherPacificIslander:
          type:
            - string
            - 'null'
        white:
          type:
            - string
            - 'null'
        demographicRaceTwoOrMoreRaces:
          type:
            - string
            - 'null'
        hispanicOrLatinoEthnicity:
          type:
            - string
            - 'null'
        countryOfBirthCode:
          type:
            - string
            - 'null'
        stateOfBirthAbbreviation:
          type:
            - string
            - 'null'
        cityOfBirth:
          type:
            - string
            - 'null'
        publicSchoolResidenceStatus:
          type:
            - string
            - 'null'
      required:
        - sourcedId
        - status
        - birthDate
        - sex
        - americanIndianOrAlaskaNative
        - asian
        - blackOrAfricanAmerican
        - nativeHawaiianOrOtherPacificIslander
        - white
        - demographicRaceTwoOrMoreRaces
        - hispanicOrLatinoEthnicity
        - countryOfBirthCode
        - stateOfBirthAbbreviation
        - cityOfBirth
        - publicSchoolResidenceStatus
      description: Represents a student's demographics information.
    SubjectEnum:
      type: string
      enum: *ref_11
    Org:
      type: object
      properties:
        sourcedId:
          type: string
        status:
          type: string
          enum: *ref_13
        dateLastModified:
          type: string
          format: date-time
        metadata:
          type:
            - object
            - 'null'
          additionalProperties: {}
        name:
          type: string
        type:
          type: string
          enum:
            - department
            - school
            - district
            - local
            - state
            - national
        identifier:
          type: string
        parent:
          type:
            - object
            - 'null'
          properties:
            href:
              type: string
              format: uri
            sourcedId:
              type: string
            type:
              type: string
          required:
            - href
            - sourcedId
            - type
        children:
          type:
            - array
            - 'null'
          items:
            type: object
            properties:
              href:
                type: string
                format: uri
              sourcedId:
                type: string
              type:
                type: string
            required:
              - href
              - sourcedId
              - type
          default: []
      required:
        - sourcedId
        - status
        - name
        - type
        - identifier
        - children
      description: Represents an organization.
