{
    "fields": {
        "name": {
            "type": "varchar",
            "required": true,
            "pattern": "$noBadCharacters",
            "view": "views/inbound-email/fields/name"
        },
        "emailAddress": {
            "type": "varchar",
            "required": true,
            "maxLength": 100,
            "view": "views/inbound-email/fields/email-address"
        },
        "status": {
            "type": "enum",
            "options": ["Active", "Inactive"],
            "style": {
                "Inactive": "info"
            },
            "default": "Active"
        },
        "host": {
            "type": "varchar",
            "massUpdateDisabled": true
        },
        "port": {
            "type": "int",
            "min": 0,
            "max": 65535,
            "default": 993,
            "disableFormatting": true,
            "massUpdateDisabled": true
        },
        "security": {
            "type": "enum",
            "default": "SSL",
            "options": ["", "SSL", "TLS"]
        },
        "username": {
            "type": "varchar"
        },
        "password": {
            "type": "password"
        },
        "monitoredFolders": {
            "type": "array",
            "default": ["INBOX"],
            "view": "views/inbound-email/fields/folders",
            "displayAsList": true,
            "noEmptyString": true,
            "duplicateIgnore": true
        },
        "fetchValidityNumber": {
            "type": "int",
            "readOnly": true,
            "default": 0
        },
        "fetchSince": {
            "type": "date",
            "validatorClassNameList": [
                "Espo\\Classes\\FieldValidators\\InboundEmail\\FetchSince\\Required"
            ],
            "forceValidation": true
        },
        "fetchData": {
            "type": "jsonObject",
            "readOnly": true,
            "duplicateIgnore": true
        },
        "assignToUser": {
            "type": "link",
            "tooltip": true
        },
        "team": {
            "type": "link",
            "tooltip": true
        },
        "teams": {
            "type": "linkMultiple",
            "tooltip": true
        },
        "addAllTeamUsers": {
            "type": "bool",
            "tooltip": true,
            "default": true
        },
        "isSystem": {
            "type": "bool",
            "notStorable": true,
            "readOnly": true,
            "directAccessDisabled": true,
            "tooltip": true
        },
        "sentFolder": {
            "type": "varchar",
            "view": "views/inbound-email/fields/folder",
            "duplicateIgnore": true
        },
        "storeSentEmails": {
            "type": "bool",
            "tooltip": true
        },
        "keepFetchedEmailsUnread": {
            "type": "bool"
        },
        "connectedAt": {
            "type": "datetime",
            "readOnly": true
        },
        "excludeFromReply": {
            "type": "bool",
            "tooltip": true
        },
        "useImap": {
            "type": "bool",
            "default": true
        },
        "useSmtp": {
            "type": "bool",
            "tooltip": true
        },
        "smtpIsShared": {
            "type": "bool",
            "tooltip": true
        },
        "smtpIsForMassEmail": {
            "type": "bool",
            "tooltip": true
        },
        "smtpHost": {
            "type": "varchar",
            "massUpdateDisabled": true
        },
        "smtpPort": {
            "type": "int",
            "min": 0,
            "max": 65535,
            "default": 587,
            "disableFormatting": true,
            "massUpdateDisabled": true
        },
        "smtpAuth": {
            "type": "bool",
            "default": true
        },
        "smtpSecurity": {
            "type": "enum",
            "default": "TLS",
            "options": ["", "SSL", "TLS"]
        },
        "smtpUsername": {
            "type": "varchar"
        },
        "smtpPassword": {
            "type": "password"
        },
        "smtpAuthMechanism": {
            "type": "enum",
            "options": ["login", "crammd5", "plain"],
            "default": "login"
        },
        "createCase": {
            "type": "bool",
            "tooltip": true
        },
        "caseDistribution": {
            "type": "enum",
            "options": ["", "Direct-Assignment", "Round-Robin", "Least-Busy"],
            "default": "Direct-Assignment",
            "tooltip": true
        },
        "targetUserPosition": {
            "type": "enum",
            "view": "views/inbound-email/fields/target-user-position",
            "tooltip": true
        },
        "reply": {
            "type": "bool",
            "tooltip": true
        },
        "replyEmailTemplate": {
            "type": "link"
        },
        "replyFromAddress": {
            "type": "varchar"
        },
        "replyToAddress": {
            "type": "varchar",
            "view": "views/fields/email-address",
            "tooltip": true
        },
        "replyFromName": {
            "type": "varchar"
        },
        "fromName": {
            "type": "varchar"
        },
        "groupEmailFolder": {
            "type": "link",
            "tooltip": true
        },
        "imapHandler": {
            "type": "varchar",
            "readOnly": true
        },
        "smtpHandler": {
            "type": "varchar",
            "readOnly": true
        },
        "createdAt": {
            "type": "datetime",
            "readOnly": true
        },
        "modifiedAt": {
            "type": "datetime",
            "readOnly": true
        },
        "createdBy": {
            "type": "link",
            "readOnly": true
        },
        "modifiedBy": {
            "type": "link",
            "readOnly": true
        }
    },
    "links": {
        "createdBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "modifiedBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "teams": {
            "type": "hasMany",
            "entity": "Team",
            "foreign": "inboundEmails"
        },
        "assignToUser": {
            "type": "belongsTo",
            "entity": "User"
        },
        "team": {
            "type": "belongsTo",
            "entity": "Team"
        },
        "replyEmailTemplate": {
            "type": "belongsTo",
            "entity": "EmailTemplate"
        },
        "filters": {
            "type": "hasChildren",
            "foreign": "parent",
            "entity": "EmailFilter"
        },
        "emails": {
            "type": "hasMany",
            "entity": "Email",
            "foreign": "inboundEmails"
        },
        "groupEmailFolder": {
            "type": "belongsTo",
            "entity": "GroupEmailFolder"
        }
    },
    "collection": {
        "orderBy": "name",
        "order": "asc"
    }
}
