query mainQuery($startDate: DateTime!, $endDate: DateTime!, $clientGroupingIDs: [Int]) {
  patrolJobDefinitions(
    filter: {schedules: {any: {startDate: {lessThan: $endDate}, endDate: {isNull: true, or: [{greaterThanOrEqualTo: $startDate}]}}}}
  ) {
    items {
      scheduledOccurrences(
        startDate: $startDate
        endDate: $endDate
        runGroupIds: $clientGroupingIDs
      ) @dataset(name: "ScheduledOccurrence") {
        runGroup {
          description
          clientGroupingID
        }
        patrolJobDefinition {
          patrolJobDefinitionID
          title
          client {
            name
          }
        }
        scheduledStartDateTime
        scheduledEndDateTime
      }
    }
  }
}
