{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/posit/main/json-schema/posit-schedule-history-response-schema.json",
  "title": "ScheduleHistoryResponse",
  "x-generated": "2026-10-03",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/posit-schedules-api-openapi.yml#/components/schemas/ScheduleHistoryResponse",
  "additionalProperties": false,
  "properties": {
    "results": {
      "description": "An array of schedule history results, one per variant.",
      "items": {
        "$ref": "#/$defs/VariantScheduleHistory"
      },
      "type": "array"
    }
  },
  "type": "object",
  "$defs": {
    "CurrentSchedule": {
      "additionalProperties": false,
      "properties": {
        "schedule": {
          "allOf": [
            {
              "$ref": "#/$defs/RRuleSet"
            }
          ],
          "description": "The schedule definition in RFC 5545 (iCalendar) format."
        },
        "next_run": {
          "description": "The next scheduled run time (RFC3339), or null if no future\nrun is scheduled.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        }
      },
      "type": "object"
    },
    "HistorySchedule": {
      "additionalProperties": false,
      "properties": {
        "schedule": {
          "allOf": [
            {
              "$ref": "#/$defs/RRuleSet"
            }
          ],
          "description": "The schedule definition in RFC 5545 (iCalendar) format."
        }
      },
      "type": "object"
    },
    "RRuleSet": {
      "additionalProperties": false,
      "description": "RFC 5545 recurrence rule components for a schedule.",
      "properties": {
        "dtstart": {
          "description": "The DTSTART component specifying when the schedule begins,\nincluding timezone information.",
          "type": "string"
        },
        "rrules": {
          "description": "An array of RRULE components defining the recurrence pattern.",
          "items": {
            "type": "string"
          },
          "type": "array"
        },
        "until": {
          "description": "The UNTIL component specifying when the schedule ends, if applicable.",
          "type": "string"
        }
      },
      "type": "object"
    },
    "ScheduleHistoryEntry": {
      "additionalProperties": false,
      "properties": {
        "change_type": {
          "description": "The type of change that was made to the schedule.",
          "type": "string"
        },
        "change_time": {
          "description": "The timestamp (RFC3339) when this change was made.",
          "format": "date-time",
          "type": "string"
        },
        "user": {
          "allOf": [
            {
              "$ref": "#/$defs/User"
            }
          ],
          "description": "The user who made this change, or null if the user has been deleted."
        },
        "new_schedule": {
          "allOf": [
            {
              "$ref": "#/$defs/HistorySchedule"
            }
          ],
          "description": "The schedule state after this change, or null if the schedule\nwas deleted."
        }
      },
      "type": "object"
    },
    "User": {
      "description": "A user object.",
      "properties": {
        "email": {
          "description": "The user's email.",
          "type": "string"
        },
        "username": {
          "description": "The user's username.",
          "type": "string"
        },
        "first_name": {
          "description": "The user's first name.",
          "type": "string"
        },
        "last_name": {
          "description": "The user's last name.",
          "type": "string"
        },
        "user_role": {
          "description": "The user's role.",
          "enum": [
            "administrator",
            "publisher",
            "viewer"
          ],
          "type": "string"
        },
        "created_time": {
          "description": "The timestamp (RFC3339) indicating when the user was created in\nthe Posit Connect server.",
          "format": "date-time",
          "type": "string"
        },
        "updated_time": {
          "description": "The timestamp (RFC3339) indicating when information about this\nuser was last updated in the Posit Connect server.",
          "format": "date-time",
          "type": "string"
        },
        "active_time": {
          "description": "The timestamp (RFC3339) indicating approximately when the user\nwas last active. Highly active users only receive periodic updates.",
          "format": "date-time",
          "type": [
            "string",
            "null"
          ]
        },
        "confirmed": {
          "description": "When `false`, the created user must confirm their account through\nan email. This feature is unique to password authentication.",
          "type": "boolean"
        },
        "locked": {
          "description": "Whether or not the user is locked.",
          "type": "boolean"
        },
        "external_id": {
          "description": "The unique identifier for this user from the authentication\nprovider, when available.",
          "type": "string"
        },
        "guid": {
          "description": "The user's GUID, or unique identifier, in UUID\n[RFC4122](https://www.rfc-editor.org/rfc/rfc4122)\nformat",
          "format": "uuid",
          "type": "string"
        }
      },
      "type": "object"
    },
    "VariantScheduleHistory": {
      "additionalProperties": false,
      "properties": {
        "variant_key": {
          "description": "The unique key identifying this variant.",
          "type": "string"
        },
        "current_schedule": {
          "allOf": [
            {
              "$ref": "#/$defs/CurrentSchedule"
            }
          ],
          "description": "The current active schedule for this variant, or null if no\nschedule exists."
        },
        "history": {
          "description": "A list of schedule change history entries, ordered by change time\n(most recent first). Limited to the 100 most recent entries.",
          "items": {
            "$ref": "#/$defs/ScheduleHistoryEntry"
          },
          "type": "array"
        },
        "total_count": {
          "description": "The total number of history entries for this variant. This may be\nlarger than the number of entries in the `history` array, which is\nlimited to 100 entries.",
          "type": "integer"
        }
      },
      "type": "object"
    }
  }
}