> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nevatal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Schedule Form Schema

> Backend-driven descriptor for the schedule editor: fields, options, validation hints and current values

The schedule editor is rendered from this descriptor — the frontend never
hardcodes day lists, location options or validation patterns. The
`schedule-blocks` section is **repeatable**: `fields` defines one block row and
the UI renders N rows with add/remove.

Location options are restricted server-side to the doctor's assigned locations.
When the doctor has a single location, the field arrives `disabled: true` with
that location preselected — the backend decides that rule, not the frontend.

## Path Parameters

<ParamField path="doctorId" type="string" required>The doctor's user ID</ParamField>

## Response

<ResponseField name="locale" type="string">`es-CO` or `en-US` — all labels arrive pre-localized.</ResponseField>

<ResponseField name="sections" type="array">
  One repeatable `schedule-blocks` section (`repeatable: true`, `minItems: 1`)
  whose `fields` describe a block row: `day` (select, 7 localized options),
  `locationId` (select, only assigned locations), `startTime`/`endTime`/
  `lunchStartTime`/`lunchEndTime` (`time` fields with `"HH:MM"` validation hints).
</ResponseField>

<ResponseField name="currentSchedule" type="object | null">
  The doctor's current schedule (same shape as Get Doctor Schedule), used to
  populate the initial rows. `null` when no schedule exists yet.
</ResponseField>

Validation hints in the schema are UX helpers only — the backend re-validates
everything on save (assigned location, overlaps, lunch-within-block).

<RequestExample>
  ```bash cURL theme={null}
  curl "https://api.nevatal.com/api/v1/appointments/doctors/schedule/66dc441b8208f63a0269eecf/form-schema" \
    -H "Authorization: Bearer nvtl_your_api_key"
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "success": true,
    "data": {
      "locale": "es-CO",
      "doctorId": "66dc441b8208f63a0269eecf",
      "sections": [
        {
          "id": "schedule-blocks",
          "name": "Bloques de horario",
          "repeatable": true,
          "minItems": 1,
          "fields": [
            { "name": "day", "label": "Día", "type": "select", "required": true,
              "options": [{ "value": "monday", "label": "Lunes" }] },
            { "name": "locationId", "label": "Sede", "type": "select", "required": true,
              "options": [
                { "value": "69616b710ea6a551535841bb", "label": "Armenia" },
                { "value": "696bdadfee83d82621f17748", "label": "Pereira" }
              ],
              "helpText": "Solo las sedes asignadas a este doctor" },
            { "name": "startTime", "label": "Hora inicio", "type": "time", "required": true,
              "validation": { "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$", "message": "Formato HH:MM" } }
          ]
        }
      ],
      "currentSchedule": null
    }
  }
  ```
</ResponseExample>
