{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://learn.microsoft.com/en-us/office/client-developer/access/desktop-database-reference/database-object-dao",
  "title": "Microsoft Access Database",
  "description": "Schema for a Microsoft Access Database object as defined in the DAO (Data Access Objects) reference. A Database object represents an open Access database (.accdb or .mdb) and provides methods and properties to manipulate its structure and data, including tables, queries, relations, and containers.",
  "type": "object",
  "required": ["name"],
  "properties": {
    "name": {
      "type": "string",
      "description": "The name and path of the database file. For a Microsoft Access database, this is the full file path to the .accdb or .mdb file.",
      "examples": ["C:\\Databases\\Northwind.accdb", "Northwind.mdb"]
    },
    "version": {
      "type": ["string", "null"],
      "description": "The version of the Microsoft Access database engine that created the database. Returns a four-character string representing the engine version number.",
      "examples": ["4.0", "3.0"]
    },
    "collatingOrder": {
      "type": ["integer", "null"],
      "description": "A value that specifies the sequence of the sort order in text for string comparison or sorting. Corresponds to locale-specific collation constants such as dbLangGeneral.",
      "examples": [1024]
    },
    "connect": {
      "type": ["string", "null"],
      "description": "A value that provides information about the source of an open database, a database used in a pass-through query, or a linked table. Contains the connection string for ODBC or external data sources.",
      "examples": ["ODBC;DSN=MyServer;DATABASE=pubs;", ""]
    },
    "queryTimeout": {
      "type": ["integer", "null"],
      "description": "A value that specifies the number of seconds to wait before a timeout error occurs when a query is executed on an ODBC data source.",
      "minimum": 0,
      "default": 60,
      "examples": [60, 120]
    },
    "recordsAffected": {
      "type": ["integer", "null"],
      "description": "The number of records affected by the most recently invoked Execute method. Read-only.",
      "minimum": 0
    },
    "updatable": {
      "type": ["boolean", "null"],
      "description": "A value that indicates whether changes can be made to the database. True if the database can be modified; False if it is read-only. Read-only."
    },
    "transactions": {
      "type": ["boolean", "null"],
      "description": "A value that indicates whether the database supports transactions (BeginTrans, CommitTrans, and Rollback). Read-only."
    },
    "designMasterID": {
      "type": ["string", "null"],
      "description": "A 16-byte value that uniquely identifies the Design Master in a replica set. Used in database replication scenarios.",
      "examples": ["{2E5FE6A0-E199-11CD-BC4C-00AA003C157A}"]
    },
    "replicaID": {
      "type": ["string", "null"],
      "description": "A 16-byte value that uniquely identifies a database replica. Read-only.",
      "examples": ["{8A0C7F3B-4E12-4B8D-9D3A-1C2E5F6A7B8C}"]
    },
    "tableDefs": {
      "type": ["array", "null"],
      "description": "A collection of all stored TableDef objects in the database. Each TableDef represents the definition of a base table or linked table.",
      "items": {
        "$ref": "#/$defs/TableDefSummary"
      }
    },
    "queryDefs": {
      "type": ["array", "null"],
      "description": "A collection of all stored QueryDef objects in the database. Each QueryDef represents the definition of a saved query.",
      "items": {
        "$ref": "#/$defs/QueryDef"
      }
    },
    "relations": {
      "type": ["array", "null"],
      "description": "A collection of all stored Relation objects in the database. Each Relation defines a relationship between fields in tables.",
      "items": {
        "$ref": "#/$defs/Relation"
      }
    },
    "containers": {
      "type": ["array", "null"],
      "description": "A collection of all Container objects in the database. Containers store information about database objects such as forms, reports, tables, and modules for security purposes.",
      "items": {
        "$ref": "#/$defs/Container"
      }
    }
  },
  "additionalProperties": true,
  "$defs": {
    "TableDefSummary": {
      "type": "object",
      "description": "A summary representation of a TableDef object within the Database's TableDefs collection.",
      "required": ["name"],
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the table.",
          "examples": ["Customers", "Orders", "Products"]
        },
        "attributes": {
          "type": ["integer", "null"],
          "description": "A value that indicates one or more characteristics of the TableDef object. Combines constants such as dbAttachExclusive, dbAttachSavePWD, dbSystemObject, dbHiddenObject, and dbAttachedTable.",
          "examples": [0, 1073741824]
        },
        "dateCreated": {
          "type": ["string", "null"],
          "format": "date-time",
          "description": "The date and time the table was created. Read-only.",
          "examples": ["2024-01-15T09:00:00Z"]
        },
        "lastUpdated": {
          "type": ["string", "null"],
          "format": "date-time",
          "description": "The date and time of the most recent change made to the table. Read-only.",
          "examples": ["2024-06-20T14:30:00Z"]
        },
        "recordCount": {
          "type": ["integer", "null"],
          "description": "The number of records in the table. For linked tables, this value is always -1.",
          "minimum": -1
        },
        "sourceTableName": {
          "type": ["string", "null"],
          "description": "For linked tables, the name of the source table in the external data source. Empty for base tables."
        },
        "connect": {
          "type": ["string", "null"],
          "description": "For linked tables, the connection string to the external data source. Empty for base tables."
        }
      }
    },
    "QueryDef": {
      "type": "object",
      "description": "A QueryDef object represents a saved query definition in the database. Contains the SQL statement and metadata for the query.",
      "required": ["name"],
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the query.",
          "examples": ["qryCustomerOrders", "qryProductSales"]
        },
        "type": {
          "type": ["integer", "null"],
          "description": "A value that indicates the type of query, such as select (0), crosstab (16), delete (32), update (48), append (64), make-table (80), DDL (96), SQL pass-through (112), union (128), or bulk (144).",
          "enum": [0, 16, 32, 48, 64, 80, 96, 112, 128, 144, null]
        },
        "sql": {
          "type": ["string", "null"],
          "description": "The SQL statement that defines the query.",
          "examples": ["SELECT * FROM Customers WHERE Country = 'USA'"]
        },
        "dateCreated": {
          "type": ["string", "null"],
          "format": "date-time",
          "description": "The date and time the query was created. Read-only."
        },
        "lastUpdated": {
          "type": ["string", "null"],
          "format": "date-time",
          "description": "The date and time of the most recent change to the query. Read-only."
        },
        "updatable": {
          "type": ["boolean", "null"],
          "description": "Whether the query definition can be changed."
        },
        "connect": {
          "type": ["string", "null"],
          "description": "The connection string for a pass-through query."
        },
        "returnsRecords": {
          "type": ["boolean", "null"],
          "description": "For SQL pass-through queries, whether the query returns records."
        }
      }
    },
    "Relation": {
      "type": "object",
      "description": "A Relation object represents a relationship between fields in tables or queries. Used to enforce referential integrity between a primary table and a foreign table.",
      "required": ["name", "table", "foreignTable"],
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the relationship.",
          "examples": ["CategoriesProducts", "CustomersOrders"]
        },
        "table": {
          "type": "string",
          "description": "The name of the primary (referenced) table in the relationship.",
          "examples": ["Categories", "Customers"]
        },
        "foreignTable": {
          "type": "string",
          "description": "The name of the foreign (referencing) table in the relationship.",
          "examples": ["Products", "Orders"]
        },
        "attributes": {
          "type": ["integer", "null"],
          "description": "A value that indicates the relationship type and enforcement rules. Combines constants: dbRelationUnique (1), dbRelationDontEnforce (2), dbRelationInherited (4), dbRelationUpdateCascade (256), dbRelationDeleteCascade (4096), dbRelationLeft (16777216), dbRelationRight (33554432).",
          "examples": [0, 256, 4096, 4352]
        },
        "fields": {
          "type": ["array", "null"],
          "description": "The fields involved in the relationship, mapping primary key fields to foreign key fields.",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "The name of the field in the primary table."
              },
              "foreignName": {
                "type": "string",
                "description": "The name of the corresponding field in the foreign table."
              }
            }
          }
        }
      }
    },
    "Container": {
      "type": "object",
      "description": "A Container object groups similar types of Document objects for security and access control. Built-in containers include Databases, Tables, and Relations.",
      "properties": {
        "name": {
          "type": "string",
          "description": "The name of the container.",
          "examples": ["Databases", "Tables", "Relations", "Forms", "Reports", "Scripts", "Modules"]
        },
        "owner": {
          "type": ["string", "null"],
          "description": "The owner of the container."
        },
        "permissions": {
          "type": ["integer", "null"],
          "description": "The permissions for the container."
        },
        "documents": {
          "type": ["array", "null"],
          "description": "The documents within this container.",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "description": "The name of the document."
              },
              "owner": {
                "type": ["string", "null"],
                "description": "The owner of the document."
              },
              "dateCreated": {
                "type": ["string", "null"],
                "format": "date-time",
                "description": "When the document was created."
              },
              "lastUpdated": {
                "type": ["string", "null"],
                "format": "date-time",
                "description": "When the document was last modified."
              }
            }
          }
        }
      }
    }
  }
}
