{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tmhsdigital.github.io/subenum/schemas/result.v1.json",
  "title": "subenum result",
  "description": "One result in subenum's JSON (an array of these) and JSONL (one per line) output. Version 1: fields are only ever added, so readers must accept fields they do not know. See https://tmhsdigital.github.io/subenum/output.html.",
  "type": "object",
  "required": ["subdomain", "records"],
  "additionalProperties": true,
  "properties": {
    "subdomain": {
      "type": "string",
      "description": "The full name found, lower case, without a trailing dot."
    },
    "records": {
      "type": "array",
      "description": "The name's records of the looked-up -type record types. Empty for a name -diff reports as removed.",
      "items": { "$ref": "#/$defs/record" }
    },
    "simulated": {
      "type": "boolean",
      "description": "true on every result of a -simulate run. Absent otherwise."
    },
    "takeover_candidate": {
      "type": "string",
      "description": "A DNS-only subdomain takeover hint: dangling, provider:<name> or dangling:<name> for a CNAME, dangling-ns for a delegation to a name server that does not exist, dangling-srv for a service whose target host does not exist. Absent when there is none.",
      "pattern": "^(dangling|dangling-ns|dangling-srv|provider:.+|dangling:.+)$"
    },
    "internal_address": {
      "type": "string",
      "description": "The most notable non-public scope among the name's addresses. Absent when every address is public.",
      "enum": ["loopback", "unspecified", "link-local", "private", "cgnat"]
    },
    "partial": {
      "type": "boolean",
      "description": "true when the lookup of a requested record type failed on every attempt while another type answered: records may lack that type. Absent otherwise."
    },
    "change": {
      "type": "string",
      "description": "With -diff: added, removed, or (with -diff-records) changed. subenum diff writes missing instead of removed. Absent outside a diff.",
      "enum": ["added", "removed", "changed", "missing"]
    },
    "previous_records": {
      "type": "array",
      "description": "The baseline's records of a changed name. Present only when change is changed.",
      "items": { "$ref": "#/$defs/record" }
    },
    "permutation": {
      "type": "boolean",
      "description": "true for a name the -permute pass found. Absent otherwise."
    },
    "sources": {
      "type": "array",
      "description": "What proposed the name, in this order: wordlist, ct, wayback, axfr, srv; or permute alone for a -permute hit, records alone for a -follow-records hit. Absent on removed names and in subenum diff output.",
      "items": { "type": "string", "enum": ["wordlist", "ct", "wayback", "axfr", "permute", "records", "srv"] }
    },
    "target": {
      "type": "string",
      "description": "The scanned domain that found the name; tells -dL results with nested targets apart. Absent on removed names and in subenum diff output."
    },
    "first_seen": {
      "type": "string",
      "format": "date-time",
      "description": "RFC 3339 time in UTC: the earliest first_seen the -diff baseline gave the name, else the run's time. Real runs only, never simulated ones. On removed names, and in subenum diff output, copied from the file the name came from."
    },
    "last_seen": {
      "type": "string",
      "format": "date-time",
      "description": "RFC 3339 time in UTC: the time of the run that found the name. Real runs only, never simulated ones. On removed names, and in subenum diff output, copied from the file the name came from."
    }
  },
  "$defs": {
    "record": {
      "type": "object",
      "required": ["type", "value"],
      "additionalProperties": true,
      "properties": {
        "type": {
          "type": "string",
          "description": "The record type.",
          "enum": ["A", "AAAA", "CNAME", "NS", "MX", "TXT", "SRV"]
        },
        "value": {
          "type": "string",
          "description": "An address; a host name for CNAME and NS; <preference> <host> for MX; the text for TXT, with a backslash and non-printable bytes written as \\DDD; <priority> <weight> <port> <target> for SRV."
        }
      }
    }
  }
}
