{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/rossdata-dev/json-schema/rossdata-dev-program-detail-schema.json",
  "title": "ProgramDetail",
  "x-generated": "2026-11-23",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/rossdata-dev-openapi.json#/components/schemas/ProgramDetail",
  "type": "object",
  "properties": {
    "basename": {
      "type": "string"
    },
    "programId": {
      "type": [
        "string",
        "null"
      ]
    },
    "title": {
      "type": [
        "string",
        "null"
      ]
    },
    "name": {
      "type": [
        "string",
        "null"
      ],
      "description": "Display name — TITLE label, or the registry description of a menu facility it backs for untitled programs"
    },
    "registryDescription": {
      "type": [
        "string",
        "null"
      ],
      "description": "Canonical description of a menu facility this program backs (GEM_FACILITIES)"
    },
    "module": {
      "type": "string"
    },
    "moduleName": {
      "type": [
        "string",
        "null"
      ]
    },
    "type": {
      "type": [
        "string",
        "null"
      ]
    },
    "typeName": {
      "type": [
        "string",
        "null"
      ]
    },
    "layer": {
      "type": "string",
      "enum": [
        "base",
        "vendor-core"
      ]
    },
    "overrides": {
      "type": [
        "string",
        "null"
      ],
      "description": "Layer this vendor-core program overrides"
    },
    "procedureCount": {
      "type": "integer"
    },
    "procedures": {
      "type": "array",
      "items": {
        "type": "string"
      },
      "description": "PROCEDURE_FORM block names"
    },
    "tableCount": {
      "type": "integer"
    },
    "writeCount": {
      "type": "integer",
      "description": "Of the referenced tables, how many the program writes to"
    },
    "tables": {
      "type": "array",
      "description": "Data Dictionary tables the program references, each classified read vs read-write. Writes are parsed from the source (FIND IN.../LOCK=WRITE update, ADD insert, DELETE); everything else is read-only.",
      "items": {
        "type": "object",
        "properties": {
          "table": {
            "type": "string"
          },
          "access": {
            "type": "string",
            "enum": [
              "read",
              "read-write"
            ],
            "description": "read-write if the program writes to the table, else read"
          },
          "writes": {
            "type": "integer",
            "description": "Number of write sites (0 for a read-only reference)"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    },
    "calls": {
      "type": [
        "object",
        "null"
      ],
      "description": "Program→program call graph. null when the program neither calls nor is called.",
      "properties": {
        "callsCount": {
          "type": "integer"
        },
        "calledByCount": {
          "type": "integer"
        },
        "calls": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ProgramCallEdge"
          },
          "description": "Programs this one invokes"
        },
        "calledBy": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/ProgramCallEdge"
          },
          "description": "Programs that invoke this one"
        },
        "note": {
          "type": "string"
        }
      }
    },
    "menu": {
      "type": [
        "array",
        "null"
      ],
      "items": {
        "$ref": "#/$defs/ProgramMenuFacility"
      },
      "description": "Menu facilities this program backs; null if none"
    },
    "source": {
      "type": "string"
    },
    "links": {
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "format": "uri"
      }
    }
  },
  "$defs": {
    "ProgramCallEdge": {
      "type": "object",
      "description": "One end of a program→program invocation (PERFORM \"GEM<mod>:<prog>\").",
      "properties": {
        "basename": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ],
          "description": "TITLE label or registry description of the target program"
        },
        "calls": {
          "type": "integer",
          "description": "Number of call sites"
        },
        "external": {
          "type": "boolean",
          "description": "An explicit EXTERNAL_ENTRY launch"
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      }
    },
    "ProgramMenuFacility": {
      "type": "object",
      "description": "A menu facility this program backs (GEM_FACILITIES /DML). See /v1/programs/{id}/facilities for match provenance.",
      "properties": {
        "facility": {
          "type": "string"
        },
        "name": {
          "type": [
            "string",
            "null"
          ]
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}