{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/observeinc/json-schema/observeinc-monitor-mute-resource-schema.json",
  "title": "MonitorMuteResource",
  "description": "A mute rule suppresses alert notifications during a defined time window. Use `target.kind: Global` to mute all monitors, or `target.kind: Monitors` to target a specific set.\n",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/observeinc-monitormute-api-openapi.yml#/components/schemas/MonitorMute-Resource",
  "type": "object",
  "required": [
    "id",
    "label",
    "description",
    "target",
    "schedule",
    "filter",
    "startTime",
    "endTime",
    "createdBy",
    "createdAt",
    "updatedBy",
    "updatedAt"
  ],
  "properties": {
    "id": {
      "$ref": "#/$defs/ObjectId"
    },
    "label": {
      "type": "string",
      "description": "Human-readable name for this mute rule."
    },
    "description": {
      "type": [
        "string",
        "null"
      ],
      "description": "Free-form description. `null` when unset."
    },
    "target": {
      "$ref": "#/$defs/MonitorMute-Target"
    },
    "schedule": {
      "$ref": "#/$defs/MonitorMute-Schedule"
    },
    "filter": {
      "type": [
        "string",
        "null"
      ],
      "description": "Optional CEL boolean expression evaluated against each fired alarm row at notification time. `null` means every firing is suppressed. Required and non-empty when `target.kind` is `Global` to prevent accidental fleet-wide suppression. Example: `level == \"Critical\" && context[\"service\"] == \"payments\"`.\n"
    },
    "startTime": {
      "$ref": "#/$defs/NullableTime",
      "description": "Computed start of the current or next active window. For `OneTime` schedules this mirrors `schedule.oneTime.startTime`. For `Recurring` schedules this is the next computed firing time. `null` between recurring windows.\n"
    },
    "endTime": {
      "$ref": "#/$defs/NullableTime",
      "description": "Computed end of the current or next active window. For `OneTime` schedules this mirrors `schedule.oneTime.endTime` (`null` for open-ended mutes). For `Recurring` schedules this is `startTime + durationSeconds`.\n"
    },
    "createdBy": {
      "$ref": "#/$defs/User"
    },
    "createdAt": {
      "$ref": "#/$defs/Time"
    },
    "updatedBy": {
      "$ref": "#/$defs/User"
    },
    "updatedAt": {
      "$ref": "#/$defs/Time"
    }
  },
  "$defs": {
    "Monitor-Brief": {
      "title": "MonitorBrief",
      "type": "object",
      "description": "Brief monitor metadata included when a reference is expanded.",
      "required": [
        "name",
        "label",
        "description"
      ],
      "properties": {
        "name": {
          "type": "string",
          "description": "Name of the monitor, unique within its workspace.\n"
        },
        "label": {
          "type": "string",
          "deprecated": true,
          "description": "Same as `name`. Deprecated; read `name` instead."
        },
        "description": {
          "type": [
            "string",
            "null"
          ],
          "description": "The monitor's description. Null when no description is configured."
        }
      }
    },
    "Monitor-Ref": {
      "title": "MonitorRef",
      "type": "object",
      "description": "Reference to a monitor. Always carries the `id`. The `record` field is\npopulated with brief metadata only when `expand=true`.\n",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "$ref": "#/$defs/ObjectId"
        },
        "record": {
          "$ref": "#/$defs/Monitor-Brief"
        }
      }
    },
    "MonitorMute-CronSchedule": {
      "title": "MonitorMuteCronSchedule",
      "type": "object",
      "required": [
        "rawCron",
        "timezone"
      ],
      "properties": {
        "rawCron": {
          "type": "string",
          "description": "POSIX 5-field cron expression (`minute hour day-of-month month day-of-week`). No seconds field, no year field, no Quartz extensions, no `@daily`-style macros. Fields support `*` (any), `,` (list), `-` (range), and `/` (step). The server rejects expressions outside this dialect with `invalid_schedule`. Examples: `0 2 * * *` (daily at 02:00), `0 9-17 * * 1-5` (every hour 09:00–17:00 Mon–Fri), `0-59/15 * * * *` (every 15 min).\n"
        },
        "timezone": {
          "type": "string",
          "description": "IANA timezone name. Example: \"America/Los_Angeles\"."
        }
      }
    },
    "MonitorMute-OneTime": {
      "title": "MonitorMuteOneTime",
      "description": "A one-time mute window. Always fully populated in responses.",
      "type": "object",
      "required": [
        "startTime",
        "endTime"
      ],
      "properties": {
        "startTime": {
          "$ref": "#/$defs/Time",
          "description": "Start of the mute window."
        },
        "endTime": {
          "$ref": "#/$defs/NullableTime",
          "description": "End of the mute window. `null` means until manually deleted."
        }
      }
    },
    "MonitorMute-Recurring": {
      "title": "MonitorMuteRecurring",
      "description": "A recurring mute window driven by a cron schedule.",
      "type": "object",
      "required": [
        "cronSchedule",
        "durationSeconds"
      ],
      "properties": {
        "cronSchedule": {
          "$ref": "#/$defs/MonitorMute-CronSchedule"
        },
        "durationSeconds": {
          "type": "integer",
          "format": "int64",
          "minimum": 1,
          "description": "Wall-clock length of each fired window in seconds. Must be at least 1."
        }
      }
    },
    "MonitorMute-Schedule": {
      "title": "MonitorMuteSchedule",
      "description": "Discriminated schedule. Both `oneTime` and `recurring` are always present in responses; the inactive sibling is `null`.\n",
      "type": "object",
      "required": [
        "kind",
        "oneTime",
        "recurring"
      ],
      "properties": {
        "kind": {
          "$ref": "#/$defs/MonitorMute-ScheduleKind"
        },
        "oneTime": {
          "description": "Populated when `kind` is `OneTime`; `null` otherwise.",
          "oneOf": [
            {
              "$ref": "#/$defs/MonitorMute-OneTime"
            },
            {
              "type": "null"
            }
          ]
        },
        "recurring": {
          "description": "Populated when `kind` is `Recurring`; `null` otherwise.",
          "oneOf": [
            {
              "$ref": "#/$defs/MonitorMute-Recurring"
            },
            {
              "type": "null"
            }
          ]
        }
      }
    },
    "MonitorMute-ScheduleKind": {
      "title": "MonitorMuteScheduleKind",
      "type": "string",
      "description": "`OneTime` defines a fixed window with an explicit start and optional end. `Recurring` fires on a cron schedule for a specified duration.\n",
      "enum": [
        "OneTime",
        "Recurring"
      ]
    },
    "MonitorMute-Target": {
      "title": "MonitorMuteTarget",
      "description": "Describes which monitors this mute rule applies to. `monitors` is always present: empty when `kind` is `Global`, non-empty when `kind` is `Monitors`.\n",
      "type": "object",
      "required": [
        "kind",
        "monitors"
      ],
      "properties": {
        "kind": {
          "$ref": "#/$defs/MonitorMute-TargetKind"
        },
        "monitors": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/Monitor-Ref"
          }
        }
      }
    },
    "MonitorMute-TargetKind": {
      "title": "MonitorMuteTargetKind",
      "type": "string",
      "description": "`Global` suppresses all monitors (requires a non-empty `filter`). `Monitors` targets a specific set of monitors by ID.\n",
      "enum": [
        "Global",
        "Monitors"
      ]
    },
    "NullableTime": {
      "type": [
        "string",
        "null"
      ],
      "format": "RFC3339"
    },
    "ObjectId": {
      "type": "string",
      "format": "ObjectId"
    },
    "Time": {
      "type": "string",
      "format": "RFC3339"
    },
    "User": {
      "title": "User",
      "type": "object",
      "required": [
        "id"
      ],
      "properties": {
        "id": {
          "title": "User Identifier",
          "$ref": "#/$defs/ObjectId"
        },
        "label": {
          "title": "User Label",
          "type": "string"
        },
        "timezone": {
          "type": "string"
        },
        "locale": {
          "type": "string"
        }
      }
    }
  }
}