{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://dioad.github.io/connect/schema/agent-status.schema.json",
  "$ref": "#/$defs/github.com.dioad.connect.sdk.agent.status.Document",
  "$defs": {
    "github.com.dioad.connect.sdk.agent.status.Document": {
      "properties": {
        "schema_version": {
          "type": "integer"
        },
        "instance_id": {
          "type": "string"
        },
        "pid": {
          "type": "integer"
        },
        "hostname": {
          "type": "string"
        },
        "boot_id": {
          "type": "string",
          "description": "`boot_id` identifies the kernel the agent runs on, which containers on the same host share. Empty where the platform has none."
        },
        "version": {
          "type": "string"
        },
        "config_file": {
          "type": "string",
          "description": "`config_file` is the config file the agent was started with, if any."
        },
        "started_at": {
          "type": "string",
          "format": "date-time"
        },
        "updated_at": {
          "type": "string",
          "format": "date-time"
        },
        "management": {
          "$ref": "#/$defs/github.com.dioad.connect.sdk.agent.status.Management",
          "description": "`management` is set when the agent serves a management interface."
        },
        "identity": {
          "$ref": "#/$defs/github.com.dioad.connect.sdk.agent.status.Identity",
          "description": "`identity` is set when the agent signs in to a Connect server."
        },
        "ready": {
          "type": "boolean",
          "description": "`ready` matches the agent's /health/ready verdict."
        },
        "ready_errors": {
          "additionalProperties": {
            "type": "string"
          },
          "type": "object",
          "description": "`ready_errors` says what is not ready, keyed by service, while the agent is not ready."
        },
        "tunnels": {
          "items": {
            "$ref": "#/$defs/github.com.dioad.connect.sdk.agent.status.Tunnel"
          },
          "type": "array"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "schema_version",
        "instance_id",
        "pid",
        "hostname",
        "started_at",
        "updated_at",
        "ready",
        "tunnels"
      ],
      "description": "Document is the content of one agent's status file."
    },
    "github.com.dioad.connect.sdk.agent.status.Identity": {
      "properties": {
        "signed_in": {
          "type": "boolean"
        },
        "waiting_since": {
          "type": "string",
          "format": "date-time",
          "description": "`waiting_since` is when the agent first failed to find a token since it last had one. Nil while signed in, or before the first attempt."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "signed_in"
      ],
      "description": "Identity reports whether the agent has signed in."
    },
    "github.com.dioad.connect.sdk.agent.status.Management": {
      "properties": {
        "listen_address": {
          "type": "string"
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "listen_address"
      ],
      "description": "Management describes the agent's management interface."
    },
    "github.com.dioad.connect.sdk.agent.status.Tunnel": {
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "endpoint": {
          "type": "string",
          "description": "`endpoint` is the Connect server endpoint the tunnel connects to."
        },
        "state": {
          "type": "string",
          "description": "`state` is the state the management console shows: registered, connecting, running, stopping, failed or stopped."
        },
        "established": {
          "type": "boolean",
          "description": "`established` reports whether the tunnel's connection is up."
        },
        "reason": {
          "type": "string",
          "description": "`reason` labels why the tunnel stopped (e.g. \"quota_exceeded\") when that was a permanent denial rather than a transient error."
        },
        "next_retry_at": {
          "type": "string",
          "format": "date-time",
          "description": "`next_retry_at` is when the next connection attempt is due, while one is pending."
        },
        "endpoint_urls": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "description": "`endpoint_urls` are the public URLs the tunnel is reachable at."
        },
        "changed_at": {
          "type": "string",
          "format": "date-time",
          "description": "`changed_at` is when the tunnel's state last changed."
        }
      },
      "additionalProperties": false,
      "type": "object",
      "required": [
        "id",
        "name",
        "type",
        "state",
        "established",
        "changed_at"
      ],
      "description": "Tunnel is one tunnel's state."
    }
  },
  "title": "connect agent status file",
  "description": "The status file a running connect agent keeps in its status directory. See doc/user/AGENT_STATUS_FILES.md."
}
