{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/xfa-tech/json-schema/xfa-tech-domain-verification-result-schema.json",
  "title": "DomainVerificationResult",
  "x-generated": "2026-11-29",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/xfa-tech-openapi.yml#/components/schemas/DomainVerificationResult",
  "type": "object",
  "properties": {
    "organization_id": {
      "type": "string",
      "description": "ID of the organization"
    },
    "domain": {
      "type": "string",
      "description": "Domain name"
    },
    "domain_timestamp": {
      "type": "string",
      "description": "Domain timestamp"
    },
    "timestamp": {
      "type": "integer",
      "format": "int64",
      "description": "Unix timestamp"
    },
    "config_id": {
      "type": "string",
      "description": "ID of the config"
    },
    "dmarc": {
      "type": "object",
      "properties": {
        "valid": {
          "type": "boolean",
          "description": "Whether DMARC record is valid"
        },
        "record": {
          "type": "string",
          "description": "DMARC record"
        },
        "error": {
          "type": "string",
          "description": "Error message if validation failed"
        },
        "security_score": {
          "type": "integer",
          "description": "Security score for DMARC"
        },
        "policy": {
          "type": "string",
          "description": "DMARC policy"
        },
        "subdomain_policy": {
          "type": "string",
          "description": "Subdomain policy"
        },
        "alignment": {
          "type": "object",
          "properties": {
            "dkim": {
              "type": "string",
              "description": "DKIM alignment (strict, relaxed)"
            },
            "spf": {
              "type": "string",
              "description": "SPF alignment (strict, relaxed)"
            }
          },
          "required": [
            "dkim",
            "spf"
          ]
        },
        "reporting": {
          "type": "object",
          "properties": {
            "aggregate_uri": {
              "type": "string",
              "description": "Aggregate reporting URI"
            },
            "forensic_uri": {
              "type": "string",
              "description": "Forensic reporting URI"
            },
            "percentage": {
              "type": "integer",
              "description": "Percentage"
            }
          },
          "required": [
            "percentage"
          ]
        },
        "recommendations": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Recommendations for improvement"
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Warnings"
        },
        "recommendation_items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DNSAdvice"
          },
          "description": "The recommendations as translatable codes, in the same order as recommendations"
        },
        "warning_items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DNSAdvice"
          },
          "description": "The warnings as translatable codes, in the same order as warnings"
        }
      },
      "required": [
        "valid",
        "security_score",
        "alignment",
        "reporting"
      ]
    },
    "spf": {
      "type": "object",
      "properties": {
        "valid": {
          "type": "boolean",
          "description": "Whether SPF record is valid"
        },
        "record": {
          "type": "string",
          "description": "SPF record"
        },
        "error": {
          "type": "string",
          "description": "Error message if validation failed"
        },
        "security_score": {
          "type": "integer",
          "description": "Security score for SPF"
        },
        "all_mechanism": {
          "type": "string",
          "description": "All mechanism"
        },
        "lookup_count": {
          "type": "integer",
          "description": "Number of lookups"
        },
        "has_ipv6": {
          "type": "boolean",
          "description": "Whether IPv6 is present"
        },
        "record_length": {
          "type": "integer",
          "description": "Record length"
        },
        "recommendations": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Recommendations for improvement"
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Warnings"
        },
        "recommendation_items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DNSAdvice"
          },
          "description": "The recommendations as translatable codes, in the same order as recommendations"
        },
        "warning_items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DNSAdvice"
          },
          "description": "The warnings as translatable codes, in the same order as warnings"
        }
      },
      "required": [
        "valid",
        "security_score",
        "lookup_count",
        "has_ipv6",
        "record_length"
      ]
    },
    "dkim": {
      "type": "object",
      "properties": {
        "selectors": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "selector": {
                "type": "string",
                "description": "Selector name"
              },
              "found": {
                "type": "boolean",
                "description": "Whether selector was found"
              },
              "valid": {
                "type": "boolean",
                "description": "Whether selector is valid"
              },
              "record": {
                "type": "string",
                "description": "DKIM record"
              },
              "key_length": {
                "type": "integer",
                "description": "Key length"
              },
              "key_algorithm": {
                "type": "string",
                "description": "Key algorithm"
              },
              "hash_algorithm": {
                "type": "string",
                "description": "Hash algorithm"
              },
              "service_type": {
                "type": "string",
                "description": "Service type"
              }
            },
            "required": [
              "selector",
              "found",
              "valid",
              "key_length"
            ]
          },
          "description": "DKIM selectors"
        },
        "security_score": {
          "type": "integer",
          "description": "Security score for DKIM"
        },
        "recommendations": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Recommendations for improvement"
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Warnings"
        },
        "recommendation_items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DNSAdvice"
          },
          "description": "The recommendations as translatable codes, in the same order as recommendations"
        },
        "warning_items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DNSAdvice"
          },
          "description": "The warnings as translatable codes, in the same order as warnings"
        }
      },
      "required": [
        "selectors",
        "security_score"
      ]
    },
    "dnssec": {
      "type": "object",
      "properties": {
        "valid": {
          "type": "boolean",
          "description": "Whether DNSSEC is valid"
        },
        "error": {
          "type": "string",
          "description": "Error message if validation failed"
        },
        "security_score": {
          "type": "integer",
          "description": "Security score for DNSSEC"
        },
        "algorithm": {
          "type": "string",
          "description": "Algorithm"
        },
        "key_length": {
          "type": "integer",
          "description": "Key length"
        },
        "chain_valid": {
          "type": "boolean",
          "description": "Whether chain is valid"
        },
        "recommendations": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Recommendations for improvement"
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Warnings"
        },
        "recommendation_items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DNSAdvice"
          },
          "description": "The recommendations as translatable codes, in the same order as recommendations"
        },
        "warning_items": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/DNSAdvice"
          },
          "description": "The warnings as translatable codes, in the same order as warnings"
        }
      },
      "required": [
        "valid",
        "security_score",
        "chain_valid"
      ]
    },
    "overall_score": {
      "type": "integer",
      "description": "Overall security score"
    },
    "ttl": {
      "type": "integer",
      "format": "int64",
      "description": "Time to live"
    }
  },
  "required": [
    "organization_id",
    "domain",
    "timestamp",
    "config_id",
    "dmarc",
    "spf",
    "dkim",
    "dnssec",
    "overall_score",
    "ttl"
  ],
  "$defs": {
    "DNSAdvice": {
      "type": "object",
      "description": "One warning or recommendation of a DNS check. Translate it by code, filling the {{name}} placeholders from params; show text for an unknown code.",
      "properties": {
        "code": {
          "type": "string",
          "description": "Stable key, for example dnssec_enable"
        },
        "params": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          },
          "description": "Values for the {{name}} placeholders in the text"
        },
        "text": {
          "type": "string",
          "description": "English text of the advice"
        }
      },
      "required": [
        "code",
        "text"
      ]
    }
  }
}