{
    "fields": {
        "name": {
            "type": "varchar",
            "required": true,
            "pattern": "$noBadCharacters"
        },
        "status": {
            "type": "enum",
            "options": ["Planned", "Held", "Not Held"],
            "default": "Planned",
            "style": {
                "Held": "success",
                "Not Held": "info"
            },
            "displayAsLabel": true,
            "labelType": "state",
            "audited": true,
            "customizationOptionsReferenceDisabled": true
        },
        "dateStart": {
            "type": "datetime",
            "required": true,
            "default": "javascript: return this.dateTime.getNow(15);",
            "audited": true,
            "view": "crm:views/call/fields/date-start"
        },
        "dateEnd": {
            "type": "datetime",
            "required": true,
            "after": "dateStart",
            "afterOrEqual": true
        },
        "duration": {
            "type": "duration",
            "start": "dateStart",
            "end": "dateEnd",
            "options": [300, 600, 900, 1800, 2700, 3600, 7200],
            "default": 300,
            "notStorable": true,
            "select": {
                "select": "TIMESTAMPDIFF_SECOND:(dateStart, dateEnd)"
            },
            "order": {
                "order": [
                    ["TIMESTAMPDIFF_SECOND:(dateStart, dateEnd)", "{direction}"]
                ]
            }
        },
        "reminders": {
            "type": "jsonArray",
            "notStorable": true,
            "orderDisabled": true,
            "view": "crm:views/meeting/fields/reminders",
            "layoutListDisabled": true,
            "validatorClassNameList": [
                "Espo\\Modules\\Crm\\Classes\\FieldValidators\\Event\\Reminders\\Valid",
                "Espo\\Modules\\Crm\\Classes\\FieldValidators\\Event\\Reminders\\MaxCount"
            ],
            "dynamicLogicDisabled": true,
            "duplicateIgnore": true
        },
        "direction": {
            "type": "enum",
            "options": ["Outbound", "Inbound"],
            "default": "Outbound"
        },
        "description": {
            "type": "text"
        },
        "parent": {
            "type": "linkParent",
            "entityList": ["Account", "Lead", "Contact", "Opportunity", "Case"]
        },
        "account": {
            "type": "link",
            "readOnly": true,
            "customizationReadOnlyDisabled": true
        },
        "uid": {
            "type": "varchar",
            "maxLength": 255,
            "index": true,
            "readOnly": true,
            "duplicateIgnore": true
        },
        "acceptanceStatus": {
            "type": "enum",
            "notStorable": true,
            "options": ["None", "Accepted", "Tentative", "Declined"],
            "style": {
                "Accepted": "success",
                "Declined": "danger",
                "Tentative": "warning"
            },
            "layoutDetailDisabled": true,
            "layoutMassUpdateDisabled": true,
            "orderDisabled": true,
            "importDisabled": true,
            "exportDisabled": true,
            "customizationDefaultDisabled": true,
            "customizationRequiredDisabled": true,
            "customizationIsSortedDisabled": true,
            "customizationReadOnlyDisabled": true,
            "customizationAuditedDisabled": true,
            "customizationOptionsReferenceDisabled": true,
            "directAccessDisabled": true,
            "filtersEnabled": true,
            "where": {
                "=": {
                    "whereClause": {
                        "OR": [
                            {
                                "id=s": {
                                    "from": "CallContact",
                                    "select": ["callId"],
                                    "whereClause": {
                                        "deleted": false,
                                        "status": "{value}"
                                    }
                                }
                            },
                            {
                                "id=s": {
                                    "from": "CallLead",
                                    "select": ["callId"],
                                    "whereClause": {
                                        "deleted": false,
                                        "status": "{value}"
                                    }
                                }
                            },
                            {
                                "id=s": {
                                    "from": "CallUser",
                                    "select": ["callId"],
                                    "whereClause": {
                                        "deleted": false,
                                        "status": "{value}"
                                    }
                                }
                            }
                        ]
                    }
                },
                "<>": {
                    "whereClause": {
                        "AND": [
                            {
                                "id!=s": {
                                    "from": "CallContact",
                                    "select": ["callId"],
                                    "whereClause": {
                                        "deleted": false,
                                        "status": "{value}"
                                    }
                                }
                            },
                            {
                                "id!=s": {
                                    "from": "CallLead",
                                    "select": ["callId"],
                                    "whereClause": {
                                        "deleted": false,
                                        "status": "{value}"
                                    }
                                }
                            },
                            {
                                "id!=s": {
                                    "from": "CallUser",
                                    "select": ["callId"],
                                    "whereClause": {
                                        "deleted": false,
                                        "status": "{value}"
                                    }
                                }
                            }
                        ]
                    }
                },
                "IN": {
                    "whereClause": {
                        "OR": [
                            {
                                "id=s": {
                                    "from": "CallContact",
                                    "select": ["callId"],
                                    "whereClause": {
                                        "deleted": false,
                                        "status": "{value}"
                                    }
                                }
                            },
                            {
                                "id=s": {
                                    "from": "CallLead",
                                    "select": ["callId"],
                                    "whereClause": {
                                        "deleted": false,
                                        "status": "{value}"
                                    }
                                }
                            },
                            {
                                "id=s": {
                                    "from": "CallUser",
                                    "select": ["callId"],
                                    "whereClause": {
                                        "deleted": false,
                                        "status": "{value}"
                                    }
                                }
                            }
                        ]
                    }
                },
                "NOT IN": {
                    "whereClause": {
                        "AND": [
                            {
                                "id!=s": {
                                    "from": "CallContact",
                                    "select": ["callId"],
                                    "whereClause": {
                                        "deleted": false,
                                        "status": "{value}"
                                    }
                                }
                            },
                            {
                                "id!=s": {
                                    "from": "CallLead",
                                    "select": ["callId"],
                                    "whereClause": {
                                        "deleted": false,
                                        "status": "{value}"
                                    }
                                }
                            },
                            {
                                "id!=s": {
                                    "from": "CallUser",
                                    "select": ["callId"],
                                    "whereClause": {
                                        "deleted": false,
                                        "status": "{value}"
                                    }
                                }
                            }
                        ]
                    }
                }
            },
            "view": "crm:views/meeting/fields/acceptance-status"
        },
        "users": {
            "type": "linkMultiple",
            "layoutDetailDisabled": true,
            "layoutListDisabled": true,
            "view": "crm:views/meeting/fields/users",
            "columns": {
                "status": "acceptanceStatus"
            },
            "additionalAttributeList": ["columns"],
            "orderBy": "name",
            "duplicatorClassName": "Espo\\Modules\\Crm\\Classes\\FieldDuplicators\\Meeting\\Attendees",
            "audited": true
        },
        "contacts": {
            "type": "linkMultiple",
            "layoutDetailDisabled": true,
            "layoutListDisabled": true,
            "view": "crm:views/call/fields/contacts",
            "columns": {
                "status": "acceptanceStatus"
            },
            "additionalAttributeList": ["columns"],
            "orderBy": "name",
            "duplicatorClassName": "Espo\\Modules\\Crm\\Classes\\FieldDuplicators\\Meeting\\Attendees",
            "audited": true
        },
        "leads": {
            "type": "linkMultiple",
            "layoutDetailDisabled": true,
            "layoutListDisabled": true,
            "view": "crm:views/call/fields/leads",
            "columns": {
                "status": "acceptanceStatus"
            },
            "additionalAttributeList": ["columns"],
            "orderBy": "name",
            "duplicatorClassName": "Espo\\Modules\\Crm\\Classes\\FieldDuplicators\\Meeting\\Attendees",
            "audited": true
        },
        "createdAt": {
            "type": "datetime",
            "readOnly": true,
            "fieldManagerParamList": [
                "useNumericFormat"
            ]
        },
        "modifiedAt": {
            "type": "datetime",
            "readOnly": true,
            "fieldManagerParamList": [
                "useNumericFormat"
            ]
        },
        "createdBy": {
            "type": "link",
            "readOnly": true,
            "view": "views/fields/user",
            "fieldManagerParamList": []
        },
        "modifiedBy": {
            "type": "link",
            "readOnly": true,
            "view": "views/fields/user",
            "fieldManagerParamList": []
        },
        "phoneNumbersMap": {
            "type": "jsonObject",
            "notStorable": true,
            "orderDisabled": true,
            "utility": true,
            "customizationDisabled": true
        },
        "assignedUser": {
            "type": "link",
            "required": true,
            "view": "views/fields/assigned-user"
        },
        "teams": {
            "type": "linkMultiple",
            "view": "views/fields/teams"
        }
    },
    "links": {
        "account": {
            "type": "belongsTo",
            "entity": "Account"
        },
        "createdBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "modifiedBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "assignedUser": {
            "type": "belongsTo",
            "entity": "User"
        },
        "teams": {
            "type": "hasMany",
            "entity": "Team",
            "relationName": "entityTeam",
            "layoutRelationshipsDisabled": true
        },
        "users": {
            "type": "hasMany",
            "entity": "User",
            "foreign": "calls",
            "additionalColumns": {
                "status": {
                    "type": "varchar",
                    "len": "36",
                    "default": "None"
                }
            },
            "columnAttributeMap": {
                "status": "acceptanceStatus"
            }
        },
        "contacts": {
            "type": "hasMany",
            "entity": "Contact",
            "foreign": "calls",
            "additionalColumns": {
                "status": {
                    "type": "varchar",
                    "len": "36",
                    "default": "None"
                }
            },
            "columnAttributeMap": {
                "status": "acceptanceStatus"
            }
        },
        "leads": {
            "type": "hasMany",
            "entity": "Lead",
            "foreign": "calls",
            "additionalColumns": {
                "status": {
                    "type": "varchar",
                    "len": "36",
                    "default": "None"
                }
            },
            "columnAttributeMap": {
                "status": "acceptanceStatus"
            }
        },
        "parent": {
            "type": "belongsToParent",
            "foreign": "calls"
        }
    },
    "collection": {
        "orderBy": "dateStart",
        "order": "desc"
    },
    "indexes": {
        "dateStartStatus": {
            "columns": ["dateStart", "status"]
        },
        "dateStart": {
            "columns": ["dateStart", "deleted"]
        },
        "status": {
            "columns": ["status", "deleted"]
        },
        "assignedUser": {
            "columns": ["assignedUserId", "deleted"]
        },
        "assignedUserStatus": {
            "columns": ["assignedUserId", "status"]
        }
    },
    "repositoryClassName": "Espo\\Core\\Repositories\\Event"
}
