{
    "fields": {
        "name": {
            "type": "varchar",
            "required": true,
            "view": "views/attachment/fields/name",
            "maxLength": 255
        },
        "type": {
            "type": "varchar",
            "maxLength": 100
        },
        "size": {
            "type": "int",
            "dbType": "bigint",
            "min": 0
        },
        "parent": {
            "type": "linkParent",
            "view": "views/attachment/fields/parent"
        },
        "related": {
            "type": "linkParent",
            "noLoad": true,
            "view": "views/attachment/fields/parent",
            "validatorClassName": "Espo\\Classes\\FieldValidators\\Attachment\\Related"
        },
        "source": {
            "type": "link",
            "readOnly": true,
            "utility": true
        },
        "field": {
            "type": "varchar",
            "utility": true
        },
        "isBeingUploaded": {
            "type": "bool",
            "default": false
        },
        "createdAt": {
            "type": "datetime",
            "readOnly": true
        },
        "createdBy": {
            "type": "link",
            "readOnly": true
        },
        "contents": {
            "type": "text",
            "notStorable": true,
            "sanitizerClassNameList": [],
            "sanitizerSuppressClassNameList": [
                "Espo\\Classes\\FieldSanitizers\\EmptyStringToNull"
            ]
        },
        "role": {
            "type": "enum",
            "maxLength": 36,
            "options": [
                "Attachment",
                "Inline Attachment",
                "Import File",
                "Export File",
                "Mail Merge",
                "Mass Pdf"
            ]
        },
        "storage": {
            "type": "varchar",
            "maxLength": 24,
            "default": null
        },
        "storageFilePath": {
            "type": "varchar",
            "maxLength": 260,
            "default": null
        },
        "global": {
            "type": "bool",
            "default": false
        }
    },
    "links": {
        "createdBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "parent": {
            "type": "belongsToParent",
            "foreign": "attachments"
        },
        "related": {
            "type": "belongsToParent"
        }
    },
    "collection": {
        "orderBy": "createdAt",
        "order": "desc"
    },
    "indexes": {
        "parent": {
            "columns": ["parentType", "parentId"]
        }
    },
    "sourceList": ["Document"]
}
