{
  "type": "object",
  "properties": {
    "project": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "id": {
              "type": "string",
              "description": "Configured project identifier."
            },
            "name": {
              "type": "string",
              "description": "Optional project label."
            },
            "site": {
              "anyOf": [
                {
                  "type": "string",
                  "description": "Configured site host."
                },
                {
                  "type": "array",
                  "items": {
                    "type": "string",
                    "description": "One recorded value."
                  },
                  "description": "Configured site hosts."
                }
              ],
              "description": "Customer-declared public site host or hosts."
            }
          },
          "required": [],
          "additionalProperties": true,
          "description": "Customer-owned project configuration; additional user fields remain possible."
        },
        {
          "type": "null"
        }
      ],
      "description": "Customer-owned project configuration; additional user fields remain possible."
    },
    "connection": {
      "type": "object",
      "properties": {
        "grant": {
          "type": "string",
          "enum": [
            "none",
            "ok",
            "refused",
            "revoked",
            "token_present_unverified"
          ],
          "description": "Current sanitized connection grant state."
        },
        "token_in_env": {
          "type": "boolean",
          "description": "Token presence only; the token is never returned."
        },
        "checked_at": {
          "type": "string",
          "description": "Last connection check timestamp."
        },
        "last_status": {
          "type": "integer",
          "minimum": 0,
          "description": "Last recorded HTTP status."
        },
        "properties": {
          "type": "array",
          "items": {
            "type": "string",
            "description": "One recorded value."
          },
          "description": "Connected property names."
        },
        "permission_levels": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "description": "Observed Google permission level."
          },
          "description": "Property name to permission level."
        }
      },
      "required": [
        "grant",
        "token_in_env"
      ],
      "additionalProperties": false,
      "description": "Sanitized connection metadata."
    },
    "handoff": {
      "anyOf": [
        {
          "type": "object",
          "properties": {
            "connectors": {
              "type": "array",
              "items": {
                "type": "string",
                "description": "One recorded value."
              },
              "description": "Original connector names."
            },
            "last_import_at": {
              "type": "string",
              "description": "Most recent handoff import timestamp."
            },
            "rows_imported": {
              "type": "integer",
              "minimum": 0,
              "description": "Cumulative imported row count."
            }
          },
          "required": [],
          "additionalProperties": true,
          "description": "Customer-editable saved handoff state."
        },
        {
          "type": "null"
        }
      ],
      "description": "Customer-editable saved handoff state."
    },
    "availability": {
      "type": "object",
      "additionalProperties": {
        "type": "object",
        "properties": {
          "property": {
            "type": "string",
            "description": "Property identifier on a newly probed result."
          },
          "first_available_date": {
            "anyOf": [
              {
                "type": "string",
                "description": "Calendar date in YYYY-MM-DD form."
              },
              {
                "type": "null"
              }
            ],
            "description": "Calendar date in YYYY-MM-DD form."
          },
          "probed_at": {
            "type": "string",
            "description": "Probe timestamp."
          },
          "probes_used": {
            "type": "integer",
            "minimum": 0,
            "description": "Probe calls used."
          },
          "basis": {
            "type": "string",
            "description": "Evidence or budget reason for the availability floor."
          },
          "cached": {
            "type": "boolean",
            "description": "Whether the saved probe was reused."
          }
        },
        "required": [
          "first_available_date",
          "probed_at",
          "probes_used",
          "basis"
        ],
        "additionalProperties": false,
        "description": "Availability probe record."
      },
      "description": "Property names mapped to saved availability probes."
    },
    "last_fetch_count": {
      "type": "integer",
      "minimum": 0,
      "description": "Saved request-cache entries."
    },
    "gsc_rows": {
      "type": "integer",
      "minimum": 0,
      "description": "Parsed local GSC rows, including window markers."
    },
    "gsc_file_missing": {
      "type": "boolean",
      "description": "No GSC JSONL file exists."
    },
    "gsc_problems": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "line": {
            "type": "integer",
            "minimum": 0,
            "description": "One-based file line."
          },
          "reason": {
            "type": "string",
            "const": "not_json",
            "description": "JSON parsing failed for this line."
          }
        },
        "required": [
          "line",
          "reason"
        ],
        "additionalProperties": false,
        "description": "Malformed JSONL line."
      },
      "description": "Malformed lines are reported without dropping the diagnostic."
    },
    "site_fact_rows": {
      "type": "integer",
      "minimum": 0,
      "description": "Parsed site fact rows."
    },
    "manual_present": {
      "type": "boolean",
      "description": "Nonempty manual inputs exist."
    },
    "manual_entries": {
      "type": "integer",
      "minimum": 0,
      "description": "Manual statements parsed."
    }
  },
  "required": [
    "project",
    "connection",
    "handoff",
    "availability",
    "last_fetch_count",
    "gsc_rows",
    "gsc_file_missing",
    "gsc_problems",
    "site_fact_rows",
    "manual_present",
    "manual_entries"
  ],
  "additionalProperties": false,
  "description": "Current repository context inventory."
}
