{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/trimble/json-schema/trimble-data-attachments-with-keys-schema.json",
  "title": "data_attachments_withKeys",
  "x-generated": "2026-11-11",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/trimble-vista-dm-openapi.yml#/components/schemas/data_attachments_withKeys",
  "allOf": [
    {
      "type": "object",
      "properties": {
        "__ryvitKeys": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "description": "Array of key paths that can be used to retrieve this object."
        },
        "__modifiedUTC": {
          "type": "string",
          "description": "UTC timestamp of when this object was last modified in the cache."
        }
      }
    },
    {
      "$ref": "#/$defs/data_attachments"
    }
  ],
  "$defs": {
    "data_attachments": {
      "required": [
        "HQCo",
        "FormName",
        "KeyField",
        "AttachmentID",
        "DocAttchYN",
        "CurrentState",
        "IsEmail",
        "KeyID"
      ],
      "type": "object",
      "properties": {
        "HQCo": {
          "type": "integer",
          "description": ""
        },
        "FormName": {
          "maxLength": 30,
          "type": "string",
          "description": ""
        },
        "KeyField": {
          "maxLength": 500,
          "type": "string",
          "description": ""
        },
        "Description": {
          "maxLength": 255,
          "type": [
            "string",
            "null"
          ],
          "description": ""
        },
        "AddedBy": {
          "maxLength": 128,
          "type": [
            "string",
            "null"
          ],
          "description": ""
        },
        "AddDate": {
          "type": [
            "string",
            "null"
          ],
          "description": ""
        },
        "DocName": {
          "maxLength": 512,
          "type": [
            "string",
            "null"
          ],
          "description": "Filesystem path to attachment bytes when HQAO SaveToDatabase=N. cache_file reads this path when staging files out of Vista."
        },
        "AttachmentID": {
          "type": "integer",
          "description": ""
        },
        "TableName": {
          "maxLength": 128,
          "type": [
            "string",
            "null"
          ],
          "description": ""
        },
        "UniqueAttchID": {
          "maxLength": 36,
          "minLength": 36,
          "pattern": "[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}",
          "type": [
            "string",
            "null"
          ],
          "description": "Vista DM attachment GUID (HQAT.UniqueAttchID). Pass to attachment_files/cache_file to download file bytes."
        },
        "OrigFileName": {
          "maxLength": 512,
          "type": [
            "string",
            "null"
          ],
          "description": ""
        },
        "DocAttchYN": {
          "enum": [
            "Y",
            "N"
          ],
          "type": "string",
          "description": ""
        },
        "CurrentState": {
          "maxLength": 1,
          "type": "string",
          "description": "(A)ttached, (S)tandalone, (D)eleted"
        },
        "AttachmentTypeID": {
          "type": [
            "integer",
            "null"
          ],
          "description": ""
        },
        "IsEmail": {
          "enum": [
            "Y",
            "N"
          ],
          "type": "string",
          "description": ""
        },
        "KeyID": {
          "type": "integer",
          "description": ""
        },
        "__custom_fields": {
          "type": "object",
          "description": "This property will be added if there are any custom fields defined for this object in Vista.  Each custom field will be a property of this object."
        }
      }
    }
  }
}