{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/mammoth-io/json-schema/mammoth-io-email-updates-out-schema.json",
  "title": "EmailUpdatesOut",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/mammoth-io-collections-api-openapi.yml#/components/schemas/EmailUpdatesOut",
  "properties": {
    "update": {
      "oneOf": [
        {
          "$ref": "#/$defs/EmailUpdateOut"
        },
        {
          "type": "null"
        }
      ]
    },
    "people": {
      "type": "integer"
    },
    "unsubscribed": {
      "items": {
        "type": "string"
      },
      "type": "array"
    },
    "boards": {
      "items": {
        "$ref": "#/$defs/BoardPreviewOut"
      },
      "type": "array"
    },
    "covered_by": {
      "items": {
        "type": "string"
      },
      "type": "array",
      "description": "Collections holding this dashboard whose updates are on"
    }
  },
  "type": "object",
  "required": [
    "boards",
    "people",
    "unsubscribed"
  ],
  "$defs": {
    "BoardPreviewOut": {
      "properties": {
        "dashboard_id": {
          "type": "integer"
        },
        "title": {
          "type": "string"
        },
        "published": {
          "type": "boolean"
        },
        "rls": {
          "type": "boolean",
          "description": "Limits rows by viewer: each reader gets their own numbers"
        },
        "figures": {
          "items": {
            "$ref": "#/$defs/FigureOut"
          },
          "type": "array"
        },
        "choices": {
          "items": {
            "$ref": "#/$defs/FigureOut"
          },
          "type": "array"
        }
      },
      "type": "object",
      "required": [
        "choices",
        "dashboard_id",
        "figures",
        "published",
        "rls",
        "title"
      ],
      "title": "BoardPreviewOut"
    },
    "EmailUpdateOut": {
      "properties": {
        "id": {
          "type": "integer"
        },
        "enabled": {
          "type": "boolean"
        },
        "trigger": {
          "$ref": "#/$defs/Trigger"
        },
        "frequency": {
          "$ref": "#/$defs/Frequency"
        },
        "weekday": {
          "oneOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "monthday": {
          "oneOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "time_of_day": {
          "type": "string"
        },
        "timezone": {
          "type": "string"
        },
        "numbers": {
          "additionalProperties": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "type": "object"
        },
        "next_run_at": {
          "oneOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "last_run_at": {
          "oneOf": [
            {
              "type": "string",
              "format": "date-time"
            },
            {
              "type": "null"
            }
          ]
        },
        "last_status": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "last_detail": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "last_delivered": {
          "type": "integer",
          "default": 0
        },
        "left_out": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object"
        }
      },
      "type": "object",
      "required": [
        "enabled",
        "frequency",
        "id",
        "numbers",
        "time_of_day",
        "timezone",
        "trigger"
      ],
      "title": "EmailUpdateOut"
    },
    "FigureOut": {
      "properties": {
        "key": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "value": {
          "oneOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        }
      },
      "type": "object",
      "required": [
        "key",
        "label"
      ],
      "title": "FigureOut"
    },
    "Frequency": {
      "type": "string",
      "enum": [
        "daily",
        "weekdays",
        "weekly",
        "monthly"
      ],
      "title": "Frequency",
      "description": "How often an update repeats (a new-data update is checked daily).",
      "default": "weekly"
    },
    "Trigger": {
      "type": "string",
      "enum": [
        "new_data",
        "schedule"
      ],
      "title": "Trigger",
      "description": "What decides that an email update goes out.",
      "default": "new_data"
    }
  }
}