{
    "fields": {
        "name": {
            "type": "varchar",
            "required": true,
            "layoutDefaultSidePanelDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "subject": {
            "type": "varchar",
            "required": true,
            "notStorable": true,
            "orderDisabled": true,
            "view": "views/email/fields/subject",
            "utility": true
        },
        "fromName": {
            "type": "varchar",
            "readOnly": true,
            "notStorable": true,
            "textFilterDisabled": true,
            "layoutFiltersDisabled": true,
            "customizationDisabled": true,
            "layoutDefaultSidePanelDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "fromAddress": {
            "type": "varchar",
            "readOnly": true,
            "notStorable": true,
            "orderDisabled": true,
            "textFilterDisabled": true,
            "layoutFiltersDisabled": true,
            "customizationDisabled": true,
            "layoutDefaultSidePanelDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "fromString": {
            "type": "varchar",
            "customizationDisabled": true,
            "layoutDefaultSidePanelDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "replyToString": {
            "type": "varchar",
            "customizationDisabled": true,
            "layoutDefaultSidePanelDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "replyToName": {
            "type": "varchar",
            "readOnly": true,
            "notStorable": true,
            "orderDisabled": true,
            "textFilterDisabled": true,
            "layoutFiltersDisabled": true,
            "customizationDisabled": true,
            "layoutDefaultSidePanelDisabled": true
        },
        "replyToAddress": {
            "type": "varchar",
            "readOnly": true,
            "notStorable": true,
            "orderDisabled": true,
            "textFilterDisabled": true,
            "layoutFiltersDisabled": true,
            "customizationDisabled": true,
            "layoutDefaultSidePanelDisabled": true
        },
        "addressNameMap": {
            "type": "jsonObject",
            "utility": true,
            "readOnly": true,
            "customizationDisabled": true
        },
        "from": {
            "type": "varchar",
            "notStorable": true,
            "orderDisabled": true,
            "required": true,
            "view": "views/email/fields/from-address-varchar",
            "textFilterDisabled": true,
            "customizationDisabled": true,
            "layoutDefaultSidePanelDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "to": {
            "type": "varchar",
            "notStorable": true,
            "orderDisabled": true,
            "required": true,
            "view": "views/email/fields/email-address-varchar",
            "validatorClassName": "Espo\\Classes\\FieldValidators\\Email\\EmailAddresses",
            "validatorClassNameList": [
                "Espo\\Classes\\FieldValidators\\Email\\Addresses\\Valid",
                "Espo\\Classes\\FieldValidators\\Email\\Addresses\\MaxCount"
            ],
            "textFilterDisabled": true,
            "customizationDisabled": true,
            "layoutDefaultSidePanelDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "cc": {
            "type": "varchar",
            "notStorable": true,
            "orderDisabled": true,
            "view": "views/email/fields/email-address-varchar",
            "validatorClassNameList": [
                "Espo\\Classes\\FieldValidators\\Email\\Addresses\\Valid",
                "Espo\\Classes\\FieldValidators\\Email\\Addresses\\MaxCount"
            ],
            "customizationDisabled": true,
            "textFilterDisabled": true,
            "layoutDefaultSidePanelDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "bcc": {
            "type": "varchar",
            "notStorable": true,
            "orderDisabled": true,
            "view": "views/email/fields/email-address-varchar",
            "validatorClassNameList": [
                "Espo\\Classes\\FieldValidators\\Email\\Addresses\\Valid",
                "Espo\\Classes\\FieldValidators\\Email\\Addresses\\MaxCount"
            ],
            "customizationDisabled": true,
            "textFilterDisabled": true,
            "layoutDefaultSidePanelDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "replyTo": {
            "type": "varchar",
            "notStorable": true,
            "orderDisabled": true,
            "view": "views/email/fields/email-address-varchar",
            "textFilterDisabled": true,
            "customizationDisabled": true,
            "layoutDefaultSidePanelDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "personStringData": {
            "type": "varchar",
            "notStorable": true,
            "orderDisabled": true,
            "utility": true,
            "view": "views/email/fields/person-string-data",
            "customizationDisabled": true
        },
        "isRead": {
            "type": "bool",
            "notStorable": true,
            "default": true,
            "readOnly": true,
            "customizationDisabled": true
        },
        "isNotRead": {
            "type": "bool",
            "notStorable": true,
            "layoutListDisabled": true,
            "layoutDetailDisabled": true,
            "layoutMassUpdateDisabled": true,
            "readOnly": true,
            "customizationDisabled": true
        },
        "isReplied": {
            "type": "bool",
            "readOnly": true,
            "customizationDisabled": true
        },
        "isNotReplied": {
            "type": "bool",
            "notStorable": true,
            "layoutListDisabled": true,
            "layoutDetailDisabled": true,
            "layoutMassUpdateDisabled": true,
            "readOnly": true,
            "customizationDisabled": true
        },
        "isImportant": {
            "type": "bool",
            "notStorable": true,
            "default": false,
            "customizationDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "inTrash": {
            "type": "bool",
            "notStorable": true,
            "default": false,
            "customizationDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "folderId": {
            "type": "varchar",
            "notStorable": true,
            "default": null,
            "textFilterDisabled": true,
            "customizationDisabled": true,
            "layoutAvailabilityList": []
        },
        "isUsers": {
            "type": "bool",
            "notStorable": true,
            "default": false,
            "customizationDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "folder": {
            "type": "link",
            "notStorable": true,
            "orderDisabled": true,
            "readOnly": true,
            "entity": "EmailFolder",
            "customizationDisabled": true
        },
        "nameHash": {
            "type": "text",
            "notStorable": true,
            "orderDisabled": true,
            "readOnly": true,
            "utility": true,
            "customizationDisabled": true
        },
        "typeHash": {
            "type": "text",
            "notStorable": true,
            "readOnly": true,
            "utility": true,
            "customizationDisabled": true
        },
        "idHash": {
            "type": "text",
            "notStorable": true,
            "orderDisabled": true,
            "readOnly": true,
            "utility": true,
            "customizationDisabled": true
        },
        "messageId": {
            "type": "varchar",
            "maxLength": 255,
            "readOnly": true,
            "index": true,
            "textFilterDisabled": true,
            "customizationDisabled": true
        },
        "messageIdInternal": {
            "type": "varchar",
            "maxLength": 300,
            "readOnly": true,
            "textFilterDisabled": true,
            "customizationDisabled": true,
            "layoutAvailabilityList": []
        },
        "emailAddress": {
            "type": "base",
            "notStorable": true,
            "view": "views/email/fields/email-address",
            "customizationDisabled": true,
            "layoutDefaultSidePanelDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "fromEmailAddress": {
            "type": "link",
            "view": "views/email/fields/from-email-address",
            "textFilterDisabled": true,
            "customizationDisabled": true,
            "layoutAvailabilityList": []
        },
        "toEmailAddresses": {
            "type": "linkMultiple",
            "customizationDisabled": true,
            "layoutAvailabilityList": []
        },
        "ccEmailAddresses": {
            "type": "linkMultiple",
            "customizationDisabled": true,
            "layoutAvailabilityList": []
        },
        "bccEmailAddresses": {
            "type": "linkMultiple",
            "customizationDisabled": true,
            "layoutAvailabilityList": []
        },
        "replyToEmailAddresses": {
            "type": "linkMultiple",
            "customizationDisabled": true,
            "layoutAvailabilityList": []
        },
        "bodyPlain": {
            "type": "text",
            "seeMoreDisabled": true,
            "clientReadOnly": true,
            "customizationDisabled": true,
            "layoutDefaultSidePanelDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "body": {
            "type": "wysiwyg",
            "view": "views/email/fields/body",
            "attachmentField": "attachments",
            "useIframe": true,
            "customizationDisabled": true,
            "layoutDefaultSidePanelDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "isHtml": {
            "type": "bool",
            "default": true,
            "fieldManagerParamList": [
                "default",
                "tooltipText"
            ],
            "inlineEditDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "status": {
            "type": "enum",
            "options": ["Draft", "Sending", "Sent", "Archived", "Failed"],
            "default": "Archived",
            "clientReadOnly": true,
            "style": {
                "Draft": "warning",
                "Failed": "danger",
                "Sending": "warning"
            },
            "customizationDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "attachments": {
            "type": "attachmentMultiple",
            "sourceList": ["Document"],
            "layoutDefaultSidePanelDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "hasAttachment": {
            "type": "bool",
            "readOnly": true,
            "customizationDisabled": true,
            "layoutDefaultSidePanelDisabled": true
        },
        "parent": {
            "type": "linkParent",
            "fieldManagerParamList": [
                "required",
                "entityList",
                "autocompleteOnEmpty",
                "audited",
                "tooltipText"
            ]
        },
        "dateSent": {
            "type": "datetime",
            "customizationDisabled": true,
            "layoutDefaultSidePanelDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "deliveryDate": {
            "type": "datetime",
            "readOnly": true,
            "customizationDisabled": true
        },
        "createdAt": {
            "type": "datetime",
            "readOnly": true,
            "fieldManagerParamList": [
                "useNumericFormat"
            ]
        },
        "modifiedAt": {
            "type": "datetime",
            "readOnly": true,
            "fieldManagerParamList": [
                "useNumericFormat"
            ]
        },
        "createdBy": {
            "type": "link",
            "readOnly": true,
            "view": "views/fields/user",
            "customizationDisabled": true
        },
        "sentBy": {
            "type": "link",
            "readOnly": true,
            "noLoad": true,
            "customizationDisabled": true
        },
        "modifiedBy": {
            "type": "link",
            "readOnly": true,
            "view": "views/fields/user",
            "customizationDisabled": true
        },
        "assignedUser": {
            "type": "link",
            "required": false,
            "view": "views/fields/assigned-user",
            "layoutMassUpdateDisabled": true
        },
        "replied": {
            "type": "link",
            "noJoin": true,
            "view": "views/email/fields/replied",
            "customizationDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "replies": {
            "type": "linkMultiple",
            "readOnly": true,
            "orderBy": "dateSent",
            "view": "views/email/fields/replies",
            "customizationDisabled": true,
            "columns": {
                "status": "status"
            },
            "layoutMassUpdateDisabled": true
        },
        "isSystem": {
            "type": "bool",
            "default": false,
            "readOnly": true,
            "customizationDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "isJustSent": {
            "type": "bool",
            "default": false,
            "utility": true,
            "notStorable": true,
            "customizationDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "isBeingImported": {
            "type": "bool",
            "utility": true,
            "notStorable": true,
            "customizationDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "teams": {
            "type": "linkMultiple",
            "view": "views/fields/teams"
        },
        "users": {
            "type": "linkMultiple",
            "noLoad": true,
            "layoutDetailDisabled": true,
            "layoutListDisabled": true,
            "layoutMassUpdateDisabled": true,
            "readOnly": true,
            "columns": {
                "inTrash": "inTrash",
                "folderId": "folderId"
            },
            "customizationDisabled": true
        },
        "assignedUsers": {
            "type": "linkMultiple",
            "layoutListDisabled": true,
            "layoutMassUpdateDisabled": true,
            "readOnly": true,
            "customizationDisabled": true
        },
        "inboundEmails": {
            "type": "linkMultiple",
            "layoutDetailDisabled": true,
            "layoutListDisabled": true,
            "layoutMassUpdateDisabled": true,
            "noLoad": true,
            "readOnly": true,
            "fieldManagerParamList": [
                "default"
            ]
        },
        "emailAccounts": {
            "type": "linkMultiple",
            "layoutDetailDisabled": true,
            "layoutListDisabled": true,
            "layoutMassUpdateDisabled": true,
            "noLoad": true,
            "readOnly": true,
            "fieldManagerParamList": [
                "default"
            ]
        },
        "icsContents": {
            "type": "text",
            "readOnly": true,
            "layoutDetailDisabled": true,
            "layoutListDisabled": true,
            "layoutMassUpdateDisabled": true,
            "customizationDisabled": true,
            "layoutAvailabilityList": []
        },
        "icsEventData": {
            "type": "jsonObject",
            "readOnly": true,
            "directAccessDisabled": true,
            "notStorable": true,
            "customizationDisabled": true,
            "layoutAvailabilityList": []
        },
        "icsEventUid": {
            "type": "varchar",
            "maxLength": 255,
            "index": true,
            "customizationDisabled": true,
            "layoutAvailabilityList": []
        },
        "icsEventDateStart": {
            "type": "datetimeOptional",
            "readOnly": true,
            "notStorable": true,
            "customizationDisabled": true,
            "layoutAvailabilityList": []
        },
        "createEvent": {
            "type": "base",
            "utility": true,
            "notStorable": true,
            "view": "views/email/fields/create-event",
            "customizationDisabled": true,
            "layoutAvailabilityList": []
        },
        "createdEvent": {
            "type": "linkParent",
            "readOnly": true,
            "view": "views/email/fields/created-event",
            "fieldManagerParamList": [
                "tooltipText"
            ],
            "layoutAvailabilityList": []
        },
        "groupFolder": {
            "type": "link",
            "layoutMassUpdateDisabled": true
        }
    },
    "links": {
        "createdBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "modifiedBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "assignedUser": {
            "type": "belongsTo",
            "entity": "User"
        },
        "teams": {
            "type": "hasMany",
            "entity": "Team",
            "relationName": "entityTeam"
        },
        "assignedUsers": {
            "type": "hasMany",
            "entity": "User",
            "relationName": "entityUser"
        },
        "users": {
            "type": "hasMany",
            "entity": "User",
            "foreign": "emails",
            "additionalColumns": {
                "isRead": {
                    "type": "bool",
                    "default": false
                },
                "isImportant": {
                    "type": "bool",
                    "default": false
                },
                "inTrash": {
                    "type": "bool",
                    "default": false
                },
                "folderId": {
                    "type": "foreignId",
                    "default": null
                }
            }
        },
        "sentBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "attachments": {
            "type": "hasChildren",
            "entity": "Attachment",
            "foreign": "parent",
            "relationName": "attachments"
        },
        "parent": {
            "type": "belongsToParent",
            "entityList": [],
            "foreign": "emails"
        },
        "replied": {
            "type": "belongsTo",
            "entity": "Email",
            "foreign": "replies"
        },
        "replies": {
            "type": "hasMany",
            "entity": "Email",
            "foreign": "replied"
        },
        "fromEmailAddress": {
            "type": "belongsTo",
            "entity": "EmailAddress"
        },
        "toEmailAddresses": {
            "type": "hasMany",
            "entity": "EmailAddress",
            "relationName": "emailEmailAddress",
            "conditions": {
                "addressType": "to"
            },
            "additionalColumns": {
                "addressType": {
                    "type": "varchar",
                    "len": "4"
                }
            }
        },
        "ccEmailAddresses": {
            "type": "hasMany",
            "entity": "EmailAddress",
            "relationName": "emailEmailAddress",
            "conditions": {
                "addressType": "cc"
            },
            "additionalColumns": {
                "addressType": {
                    "type": "varchar",
                    "len": "4"
                }
            },
            "layoutDefaultSidePanelDisabled": true
        },
        "bccEmailAddresses": {
            "type": "hasMany",
            "entity": "EmailAddress",
            "relationName": "emailEmailAddress",
            "conditions": {
                "addressType": "bcc"
            },
            "additionalColumns": {
                "addressType": {
                    "type": "varchar",
                    "len": "4"
                }
            },
            "layoutDefaultSidePanelDisabled": true
        },
        "replyToEmailAddresses": {
            "type": "hasMany",
            "entity": "EmailAddress",
            "relationName": "emailEmailAddress",
            "conditions": {
                "addressType": "rto"
            },
            "additionalColumns": {
                "addressType": {
                    "type": "varchar",
                    "len": "4"
                }
            }
        },
        "inboundEmails": {
            "type": "hasMany",
            "entity": "InboundEmail",
            "foreign": "emails"
        },
        "emailAccounts": {
            "type": "hasMany",
            "entity": "EmailAccount",
            "foreign": "emails"
        },
        "createdEvent": {
            "type": "belongsToParent",
            "entityList": ["Meeting"]
        },
        "groupFolder": {
            "type": "belongsTo",
            "entity": "GroupEmailFolder",
            "foreign": "emails"
        }
    },
    "collection": {
        "orderBy": "dateSent",
        "order": "desc",
        "textFilterFields": ["name", "bodyPlain", "body"],
        "countDisabled": true,
        "fullTextSearch": true,
        "fullTextSearchOrderType": "original"
    },
    "indexes": {
        "createdById": {
            "columns": ["createdById"]
        },
        "dateSent": {
            "columns": ["dateSent", "deleted"]
        },
        "dateSentStatus": {
            "columns": ["dateSent", "status", "deleted"]
        }
    }
}
