{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/difficat-com/json-schema/difficat-com-snapshot-detail-schema.json",
  "title": "SnapshotDetail",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/difficat-com-openapi.yml#/components/schemas/SnapshotDetail",
  "type": "object",
  "required": [
    "snapshot",
    "pages",
    "compares"
  ],
  "properties": {
    "snapshot": {
      "$ref": "#/$defs/Snapshot"
    },
    "pages": {
      "type": "array",
      "description": "Empty until the snapshot is ready.",
      "items": {
        "type": "object",
        "required": [
          "n",
          "path"
        ],
        "properties": {
          "n": {
            "type": "integer"
          },
          "path": {
            "type": "string"
          },
          "label": {
            "type": "string",
            "description": "The snapshot’s name: its URL and time taken in UTC (marked \"UTC\"), or what the owner set."
          },
          "labelEdited": {
            "type": "boolean",
            "description": "Whether the owner set the label."
          },
          "takenAt": {
            "type": "integer",
            "description": "When the snapshot was taken, epoch ms."
          },
          "status": {
            "type": "integer",
            "description": "The HTTP status the page answered with; 0 when unreachable."
          },
          "screenshot": {
            "type": "boolean",
            "description": "Whether a screenshot was stored."
          }
        }
      }
    },
    "compares": {
      "type": "array",
      "description": "The caller’s own compares that use the snapshot.",
      "items": {
        "type": "object",
        "required": [
          "id",
          "snapshotAId",
          "snapshotBId",
          "status",
          "via",
          "createdAt",
          "saved"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "snapshotAId": {
            "type": "string"
          },
          "snapshotBId": {
            "type": "string"
          },
          "snapshotIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Every set the compare’s pairs use; absent on a compare saved before pairs."
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "ready"
            ]
          },
          "via": {
            "type": "string",
            "enum": [
              "snapshots",
              "run"
            ]
          },
          "createdAt": {
            "type": "integer",
            "description": "Epoch ms."
          },
          "saved": {
            "type": "boolean",
            "description": "Kept until deleted (created by a Pro account); otherwise removed 30 days after creation."
          },
          "summary": {
            "type": "object",
            "required": [
              "totalPages",
              "passed",
              "failed"
            ],
            "properties": {
              "totalPages": {
                "type": "integer"
              },
              "passed": {
                "type": "integer"
              },
              "failed": {
                "type": "integer"
              }
            }
          },
          "threshold": {
            "type": "number"
          }
        }
      }
    },
    "sharedCompareCount": {
      "type": "integer",
      "description": "Owner only: compares others saved against it."
    }
  },
  "$defs": {
    "Snapshot": {
      "type": "object",
      "required": [
        "id",
        "label",
        "origin",
        "viewportWidth",
        "checkMode",
        "pageCount",
        "status",
        "createdAt",
        "updatedAt",
        "access"
      ],
      "properties": {
        "id": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "origin": {
          "type": "string",
          "format": "uri",
          "description": "The captured site’s origin; it is never fetched by a compare."
        },
        "viewportWidth": {
          "type": "integer"
        },
        "threshold": {
          "type": "number",
          "minimum": 0,
          "maximum": 1,
          "description": "The visual tolerance the snapshot was taken with, as a fraction. Absent on a snapshot taken before it was stored. A run against the snapshot uses it unless the request names a threshold."
        },
        "checkMode": {
          "type": "string",
          "enum": [
            "full",
            "text-only",
            "existence-only"
          ]
        },
        "pageCount": {
          "type": "integer"
        },
        "errorPages": {
          "type": "integer",
          "description": "Pages that answered with an error status or were unreachable."
        },
        "status": {
          "type": "string",
          "enum": [
            "capturing",
            "ready"
          ]
        },
        "via": {
          "type": "string",
          "enum": [
            "capture",
            "run"
          ]
        },
        "createdAt": {
          "type": "integer",
          "description": "Epoch ms."
        },
        "updatedAt": {
          "type": "integer",
          "description": "Epoch ms."
        },
        "completedAt": {
          "type": "integer",
          "description": "Epoch ms."
        },
        "access": {
          "type": "string",
          "enum": [
            "owner",
            "reader"
          ],
          "description": "The caller’s role on the snapshot."
        }
      }
    }
  }
}