Counter

Set a min or max of occurances in the total planning period:

min/max days
{
  "rules": [
    {
      "constraint": "COUNTER",
      "type": "WORKING_DAYS",
      "min": 2,
      "max": 4
    }
  ]
}
min/max days idle
{
  "rules": [
    {
      "constraint": "COUNTER",
      "type": "DAYS_IDLE",
      "min": 1,
      "max": 2
    }
  ]
}
min/max weekends idle
{
  "rules": [
    {
      "constraint": "COUNTER",
      "type": "WEEKENDS_IDLE",
      "min": 1,
      "max": 2
    }
  ]
}
min/max night shifts
{
  "rules": [
    {
      "constraint": "COUNTER",
      "type": "WORKING_SHIFT_TYPE",
      "tags": [
        "NIGHT"
      ],
      "max": 3
    }
  ]
}

Or define that planning period yourself with a range (from/to) or with a rolling horizon (`duration)

period range
{
  "rules": [
    {
      "constraint": "COUNTER",
      "type": "WORKING_SHIFT_TYPE",
      "tags": [
        "NIGHT"
      ],
      "max": 3,
      "period": {
        "from": "2024-03-06T08:00:00",
        "to": "2024-03-10T17:00:00"
      }
    }
  ]
}
period rolling horizon 3 days
{
  "rules": [
    {
      "constraint": "COUNTER",
      "type": "WORKING_SHIFT_TYPE",
      "tags": [
        "NIGHT"
      ],
      "max": 3,
      "period": {
        "duration": "PT3D"
      }
    }
  ]
}

Sequence

Or require the maximum sequence. So instead of counting the total days in a period, it’s a constraint setting limits to the consecutive occurance.

Eg max 4 working days in sequence (in a row):

min/max consecutive days
{
  "rules": [
    {
      "constraint": "SEQUENCE",
      "type": "WORKING_DAYS",
      "min": 2,
      "max": 4
    }
  ]
}

Conditional rule

A counter overrun can trigger a sequence rule.

Eg: If 20 hours worked of a night shift within 3 days, then 2 days idle after that

conditional
{
  "rules" : [ {
    "constraint" : "COUNTER",
    "type" : "HOURS_WORKED",
    "period" : {
      "duration" : "PT72H"
    },
    "min" : 20,
    "max" : 1,
    "tags" : [ "NIGHT" ],
    "then" : {
      "constraint" : "SEQUENCE",
      "type" : "DAYS_IDLE",
      "min" : 2,
      "max" : 1
    }
  } ]
}