{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/opoint/json-schema/opoint-notification-schema.json",
  "title": "Notification",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/opoint-notifications-api-openapi.yml#/components/schemas/Notification",
  "type": "object",
  "properties": {
    "id": {
      "type": "integer",
      "readOnly": true
    },
    "title": {
      "type": "string",
      "maxLength": 255
    },
    "read": {
      "type": "boolean",
      "default": false
    },
    "object": {
      "oneOf": [
        {
          "$ref": "#/$defs/NotificationFieldValue"
        },
        {
          "type": "null"
        }
      ]
    }
  },
  "required": [
    "id",
    "title"
  ],
  "$defs": {
    "BaseReport": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        },
        "download": {
          "type": "string",
          "readOnly": true
        },
        "title": {
          "type": "string"
        },
        "status": {
          "type": "integer",
          "readOnly": true
        },
        "timeFinished": {
          "type": "integer"
        },
        "type": {
          "type": "integer",
          "readOnly": true
        },
        "articles": {
          "type": "integer",
          "readOnly": true
        },
        "timestampFrom": {
          "type": "integer",
          "readOnly": true
        },
        "timestampTo": {
          "type": "integer",
          "readOnly": true
        }
      },
      "required": [
        "articles",
        "download",
        "id",
        "status",
        "timeFinished",
        "timestampFrom",
        "timestampTo",
        "title",
        "type"
      ]
    },
    "Export": {
      "type": "object",
      "description": "Serializer for returning statistics export data from notifications",
      "properties": {
        "id": {
          "type": "integer"
        },
        "download": {
          "type": "string",
          "readOnly": true
        },
        "title": {
          "type": "string"
        },
        "status": {
          "type": "integer",
          "readOnly": true
        },
        "timeFinished": {
          "type": "integer"
        },
        "type": {
          "type": "integer",
          "readOnly": true
        },
        "articles": {
          "type": "integer",
          "readOnly": true
        },
        "timestampFrom": {
          "type": "integer",
          "readOnly": true
        },
        "timestampTo": {
          "type": "integer",
          "readOnly": true
        }
      },
      "required": [
        "articles",
        "download",
        "id",
        "status",
        "timeFinished",
        "timestampFrom",
        "timestampTo",
        "title",
        "type"
      ]
    },
    "NotificationFieldExport": {
      "type": "object",
      "description": "Single purpose serializer: Servers only to correctly describe a NotificationRelatedField field\nwhere the value is ExportSerializer.",
      "properties": {
        "type": {
          "type": "string"
        },
        "value": {
          "oneOf": [
            {
              "$ref": "#/$defs/Export"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "type",
        "value"
      ]
    },
    "NotificationFieldReport": {
      "type": "object",
      "description": "Single purpose serializer: Servers only to correctly describe a NotificationRelatedField field\nwhere the value is ReportSerializer.",
      "properties": {
        "type": {
          "type": "string"
        },
        "value": {
          "oneOf": [
            {
              "$ref": "#/$defs/Report"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "type",
        "value"
      ]
    },
    "NotificationFieldSiteExport": {
      "type": "object",
      "description": "Single purpose serializer: Servers only to correctly describe a NotificationRelatedField field\nwhere the value is BaseReportSerializer.",
      "properties": {
        "type": {
          "type": "string"
        },
        "value": {
          "oneOf": [
            {
              "$ref": "#/$defs/BaseReport"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "type",
        "value"
      ]
    },
    "NotificationFieldTrackingExport": {
      "type": "object",
      "description": "Single purpose serializer: Servers only to correctly describe a NotificationRelatedField field\nwhere the value is ReportSerializer.",
      "properties": {
        "type": {
          "type": "string"
        },
        "value": {
          "oneOf": [
            {
              "$ref": "#/$defs/BaseReport"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "required": [
        "type",
        "value"
      ]
    },
    "NotificationFieldValue": {
      "oneOf": [
        {
          "$ref": "#/$defs/NotificationFieldExport"
        },
        {
          "$ref": "#/$defs/NotificationFieldReport"
        },
        {
          "$ref": "#/$defs/NotificationFieldTrackingExport"
        },
        {
          "$ref": "#/$defs/NotificationFieldSiteExport"
        }
      ]
    },
    "Report": {
      "type": "object",
      "properties": {
        "id": {
          "type": "integer"
        },
        "download": {
          "type": "string",
          "readOnly": true
        },
        "title": {
          "type": "string"
        },
        "status": {
          "type": "integer",
          "readOnly": true
        },
        "timeFinished": {
          "type": "integer"
        },
        "type": {
          "type": "integer",
          "readOnly": true
        },
        "articles": {
          "type": "integer",
          "readOnly": true
        },
        "timestampFrom": {
          "type": "integer",
          "readOnly": true
        },
        "timestampTo": {
          "type": "integer",
          "readOnly": true
        },
        "pdfPages": {
          "type": "integer"
        },
        "pdfBytes": {
          "type": "integer"
        }
      },
      "required": [
        "articles",
        "download",
        "id",
        "pdfBytes",
        "pdfPages",
        "status",
        "timeFinished",
        "timestampFrom",
        "timestampTo",
        "title",
        "type"
      ]
    }
  }
}