{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/safetyculture/json-schema/safetyculture-s12-scheduling-feed-v1-feed-schedules-response-schema.json",
  "title": "FeedSchedulesResponse",
  "description": "The response for `FeedSchedules` V2",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/safetyculture-data-feeds-api-openapi.yml#/components/schemas/s12.scheduling.feed.v1.FeedSchedulesResponse",
  "type": "object",
  "properties": {
    "metadata": {
      "description": "The metadata for the feed.",
      "allOf": [
        {
          "$ref": "#/$defs/s12.common.v1.FeedMetadataSimple"
        }
      ]
    },
    "data": {
      "type": "array",
      "items": {
        "type": "object",
        "$ref": "#/$defs/s12.scheduling.feed.v1.FeedScheduleRecord"
      },
      "description": "The flat list of schedule records."
    },
    "total_records": {
      "type": "integer",
      "format": "int32",
      "description": "Total number of records."
    }
  },
  "$defs": {
    "s12.common.v1.FeedMetadataSimple": {
      "type": "object",
      "properties": {
        "next_page": {
          "type": "string",
          "description": "Full path to retrieve the next page of results, including the next_page_token."
        },
        "next_page_token": {
          "type": "string",
          "description": "The value you can use to retrieve additional results.\nIf a value exists, it means there are more results than listed.\nUse the value in your request body as a page_token to view more results."
        }
      },
      "description": "FeedMetadataSimple for a feed."
    },
    "s12.scheduling.feed.v1.FeedScheduleRecord": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "description": "Unique identifier for this schedule.\nFormat: `scheduleitem_{schedule_id}`\nExample: `scheduleitem_123`."
        },
        "title": {
          "type": "string",
          "description": "Display name of the schedule. For example, `Weekly Safety Inspection` or `Monthly Equipment Check`."
        },
        "recurrence": {
          "type": "string",
          "description": "Schedule recurrence pattern in RFC 5545 RRule format.\nFor example, `FREQ=DAILY`, `FREQ=WEEKLY;BYDAY=MO,WE,FR`, `FREQ=MONTHLY;BYMONTHDAY=1`\nSee: https://tools.ietf.org/html/rfc5545#section-3.3.10."
        },
        "duration": {
          "type": "string",
          "description": "Expected inspection duration (ISO 8601 duration format; for example, `PT30M` (30 minutes), `PT2H` (2 hours), `PT1H30M` (1.5 hours)."
        },
        "modified_at": {
          "type": "string",
          "format": "date-time",
          "description": "Last updated timestamp (UTC format)."
        },
        "organisation_id": {
          "type": "string",
          "description": "ID of the organization that owns this schedule."
        },
        "created_at": {
          "type": "string",
          "format": "date-time",
          "description": "Created timestamp (UTC format)."
        },
        "completion_rule": {
          "type": "string",
          "description": "Completion requirement for the scheduled inspection. One of: `any` (at least one assignee must complete) or `all` (every assignee must complete)."
        },
        "status": {
          "type": "string",
          "description": "Current operational status of the schedule.\n• `ACTIVE`: Schedule is running and creating occurrences.\n• `PAUSED`: Schedule is temporarily stopped.\n• `FINISHED`: Schedule has ended (past end date or max occurrences)."
        },
        "timezone": {
          "type": "string",
          "description": "Timezone for schedule execution (IANA timezone identifier). For example, `America/New_York`, `Europe/London` or `UTC`."
        },
        "timezone_type": {
          "type": "string",
          "description": "How the schedule's timezone is determined.\n• `CUSTOM_TIMEZONE`: Uses the timezone specified in the 'timezone' field.\n• `SITE_TIMEZONE`: Uses the timezone of the site where inspection occurs."
        },
        "is_late_submit_allowed": {
          "type": "boolean",
          "description": "Whether inspections can be started after the due date."
        },
        "site_ids": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Site IDs where the schedule is performed. May be empty for non-site-based schedules."
        },
        "template_id": {
          "type": "string",
          "description": "Template ID associated with the schedule."
        },
        "created_by": {
          "type": "string",
          "description": "ID of the user who created the schedule."
        },
        "grace_period_duration": {
          "type": "string",
          "description": "Grace period duration in ISO 8601 format. For example, `PT1H`."
        },
        "site_based_assignment_enabled": {
          "type": "boolean",
          "description": "Whether to use site-based assignees."
        },
        "ending_rule_type": {
          "type": "string",
          "description": "How the schedule ends: `never`, `end_date`, or `end_after_repeats`."
        },
        "ending_rule_end_date": {
          "type": "string",
          "description": "End date when ending_rule_type is `end_date` (ISO datetime string).\n• Only populated when `ending_rule_type` = `end_date`."
        },
        "ending_rule_end_after_repeats": {
          "type": "integer",
          "format": "int32",
          "description": "Number of repeats when `ending_rule_type` is `end_after_repeats`.\n• Only populated when `ending_rule_type` = `end_after_repeats`."
        },
        "assignees": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Assignee IDs."
        },
        "intersections": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Intersection group IDs (if schedule is using site+group intersection-based assignment)."
        },
        "schedule_type": {
          "description": "The type of schedule.",
          "allOf": [
            {
              "$ref": "#/$defs/s12.scheduling.v1.ScheduleType"
            }
          ]
        },
        "asset_ids": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "The assets assigned to this schedule item.\nIt is empty if asset IDs are not used for assignment."
        }
      },
      "description": "A schedule record returned from `FeedSchedules` V2",
      "title": "FeedScheduleRecord"
    },
    "s12.scheduling.v1.ScheduleType": {
      "type": "string",
      "enum": [
        "SCHEDULE_TYPE_UNSPECIFIED",
        "SCHEDULE_TYPE_USERS",
        "SCHEDULE_TYPE_SITES",
        "SCHEDULE_TYPE_ASSETS"
      ],
      "default": "SCHEDULE_TYPE_UNSPECIFIED",
      "description": "- SCHEDULE_TYPE_UNSPECIFIED: Unspecified schedule type\n - SCHEDULE_TYPE_USERS: User-based schedule\n - SCHEDULE_TYPE_SITES: Site-based schedule\n - SCHEDULE_TYPE_ASSETS: Asset-based schedule",
      "title": "ScheduleType is the type of schedule"
    }
  }
}