{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/hootlens-com/json-schema/hootlens-com-weekly-digest-schema.json",
  "title": "WeeklyDigest",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/hootlens-com-openapi.json#/components/schemas/WeeklyDigest",
  "type": "object",
  "properties": {
    "projectId": {
      "$ref": "#/$defs/Id"
    },
    "projectName": {
      "type": "string"
    },
    "generatedAt": {
      "type": "integer",
      "description": "Epoch milliseconds.",
      "minimum": 0
    },
    "period": {
      "type": "object",
      "properties": {
        "from": {
          "type": "integer",
          "description": "Epoch milliseconds.",
          "minimum": 0
        },
        "to": {
          "type": "integer",
          "description": "Epoch milliseconds.",
          "minimum": 0
        },
        "weekEnding": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "label": {
          "type": "string"
        },
        "previousFrom": {
          "type": "integer",
          "description": "Epoch milliseconds.",
          "minimum": 0
        },
        "previousTo": {
          "type": "integer",
          "description": "Epoch milliseconds.",
          "minimum": 0
        },
        "includesToday": {
          "type": "boolean"
        }
      },
      "additionalProperties": true
    },
    "privacy": {
      "type": "string",
      "enum": [
        "full",
        "balanced",
        "strict"
      ]
    },
    "noData": {
      "type": "boolean"
    },
    "visits": {
      "type": "object",
      "properties": {
        "thisWeek": {
          "type": "integer"
        },
        "lastWeek": {
          "oneOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "changePercent": {
          "oneOf": [
            {
              "type": "number"
            },
            {
              "type": "null"
            }
          ]
        },
        "fewVisits": {
          "type": "boolean"
        },
        "text": {
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "snags": {
      "type": "object",
      "properties": {
        "elements": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          }
        },
        "totalThisWeek": {
          "type": "integer"
        },
        "totalLastWeek": {
          "oneOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "text": {
          "type": "string"
        },
        "countedFrom": {
          "type": "string",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        }
      },
      "additionalProperties": true
    },
    "sources": {
      "type": "object",
      "description": "Where the week's visits came from. Visits on days before channels and countries were counted are reported as notRecorded.",
      "properties": {
        "channels": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          }
        },
        "countries": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          }
        },
        "channelTotals": {
          "type": "object",
          "description": "Shown plus other plus notRecorded equals visits.",
          "properties": {
            "visits": {
              "type": "integer"
            },
            "shown": {
              "type": "integer"
            },
            "other": {
              "type": "integer"
            },
            "notRecorded": {
              "type": "integer"
            }
          },
          "required": [
            "visits",
            "shown",
            "other",
            "notRecorded"
          ],
          "additionalProperties": true
        },
        "countryTotals": {
          "type": "object",
          "description": "Shown plus other plus unresolved plus notRecorded equals visits.",
          "properties": {
            "visits": {
              "type": "integer"
            },
            "shown": {
              "type": "integer"
            },
            "other": {
              "type": "integer"
            },
            "unresolved": {
              "type": "integer"
            },
            "notRecorded": {
              "type": "integer"
            }
          },
          "required": [
            "visits",
            "shown",
            "other",
            "notRecorded"
          ],
          "additionalProperties": true
        },
        "countedFrom": {
          "type": "string",
          "description": "The first day channels and countries are counted, set when the week holds earlier visits.",
          "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
        },
        "text": {
          "type": "string"
        }
      },
      "required": [
        "channels",
        "countries",
        "channelTotals",
        "countryTotals",
        "text"
      ],
      "additionalProperties": true
    },
    "goals": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {},
        "additionalProperties": true
      }
    },
    "changes": {
      "type": "object",
      "properties": {
        "logged": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          }
        },
        "verdicts": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {},
            "additionalProperties": true
          }
        }
      },
      "additionalProperties": true
    },
    "funnels": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {},
        "additionalProperties": true
      }
    },
    "watch": {
      "type": "object",
      "properties": {
        "kind": {
          "type": "string"
        },
        "text": {
          "type": "string"
        }
      },
      "additionalProperties": true
    },
    "notes": {
      "type": "array",
      "items": {
        "type": "string",
        "description": "What the numbers cannot say."
      }
    }
  },
  "required": [
    "projectId",
    "projectName",
    "generatedAt",
    "period",
    "privacy",
    "noData",
    "visits",
    "snags",
    "goals",
    "changes",
    "funnels",
    "watch",
    "notes"
  ],
  "additionalProperties": true,
  "$defs": {
    "Id": {
      "type": "string",
      "description": "An identifier: 1 to 80 letters, digits, underscores or hyphens.",
      "pattern": "^[a-zA-Z0-9_-]{1,80}$"
    }
  }
}