{
    "fields": {
        "name": {
            "type": "varchar",
            "required": true,
            "pattern": "$noBadCharacters"
        },
        "status": {
            "type": "enum",
            "options": [
                "Not Started",
                "Started",
                "Completed",
                "Canceled",
                "Deferred"
            ],
            "style": {
                "Completed": "success",
                "Started": "primary",
                "Canceled": "info"
            },
            "default": "Not Started",
            "displayAsLabel": true,
            "labelType": "state",
            "audited": true,
            "fieldManagerAdditionalParamList": [
                {
                    "name": "notActualOptions",
                    "view": "views/admin/field-manager/fields/not-actual-options"
                }
            ],
            "notActualOptions": ["Completed", "Canceled", "Deferred"],
            "customizationOptionsReferenceDisabled": true
        },
        "priority": {
            "type": "enum",
            "options": [
                "Low",
                "Normal",
                "High",
                "Urgent"
            ],
            "default": "Normal",
            "displayAsLabel": true,
            "style": {
                "High": "warning",
                "Urgent": "danger"
            },
            "audited": true,
            "customizationOptionsReferenceDisabled": true
        },
        "dateStart": {
            "type": "datetimeOptional",
            "before": "dateEnd"
        },
        "dateEnd": {
            "type": "datetimeOptional",
            "after": "dateStart",
            "view": "crm:views/task/fields/date-end",
            "audited": true
        },
        "dateStartDate": {
            "type": "date",
            "utility": true
        },
        "dateEndDate": {
            "type": "date",
            "utility": true
        },
        "dateCompleted": {
            "type": "datetime",
            "readOnly": true
        },
        "isOverdue": {
            "type": "bool",
            "readOnly": true,
            "notStorable": true,
            "orderDisabled": true,
            "view": "crm:views/task/fields/is-overdue",
            "utility": true
        },
        "reminders": {
            "type": "jsonArray",
            "notStorable": true,
            "orderDisabled": true,
            "view": "crm:views/meeting/fields/reminders",
            "dateField": "dateEnd",
            "validatorClassNameList": [
                "Espo\\Modules\\Crm\\Classes\\FieldValidators\\Event\\Reminders\\Valid",
                "Espo\\Modules\\Crm\\Classes\\FieldValidators\\Event\\Reminders\\MaxCount"
            ],
            "duplicateIgnore": true,
            "dynamicLogicDisabled": true
        },
        "description": {
            "type": "text",
            "preview": true,
            "attachmentField": "attachments",
            "cutHeight": 500
        },
        "parent": {
            "type": "linkParent",
            "entityList": ["Account", "Contact", "Lead", "Opportunity", "Case"]
        },
        "account": {
            "type": "link",
            "readOnly": true,
            "customizationReadOnlyDisabled": true
        },
        "contact": {
            "type": "link",
            "readOnly": true,
            "customizationReadOnlyDisabled": true
        },
        "originalEmail": {
            "type": "link",
            "notStorable": true,
            "entity": "Email",
            "utility": true,
            "orderDisabled": true,
            "directAccessDisabled": 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": []
        },
        "assignedUser": {
            "type": "link",
            "required": true,
            "view": "views/fields/assigned-user"
        },
        "teams": {
            "type": "linkMultiple",
            "view": "views/fields/teams"
        },
        "collaborators": {
            "type": "linkMultiple",
            "view": "views/fields/collaborators",
            "maxCount": 30,
            "fieldManagerParamList": [
                "readOnly",
                "readOnlyAfterCreate",
                "audited",
                "autocompleteOnEmpty",
                "maxCount",
                "inlineEditDisabled",
                "tooltipText"
            ],
            "dynamicLogicVisibleDisabled": true
        },
        "attachments": {
            "type": "attachmentMultiple",
            "sourceList": ["Document"]
        }
    },
    "links": {
        "createdBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "modifiedBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "assignedUser": {
            "type": "belongsTo",
            "entity": "User",
            "foreign": "tasks"
        },
        "teams": {
            "type": "hasMany",
            "entity": "Team",
            "relationName": "entityTeam",
            "layoutRelationshipsDisabled": true
        },
        "collaborators": {
            "type": "hasMany",
            "entity": "User",
            "relationName": "entityCollaborator",
            "layoutRelationshipsDisabled": true
        },
        "parent": {
            "type": "belongsToParent",
            "foreign": "tasks"
        },
        "account": {
            "type": "belongsTo",
            "entity": "Account"
        },
        "contact": {
            "type": "belongsTo",
            "entity": "Contact"
        },
        "email": {
            "type": "belongsTo",
            "entity": "Email",
            "foreign": "tasks",
            "noForeignName": true
        }
    },
    "collection": {
        "orderBy": "createdAt",
        "order": "desc"
    },
    "indexes": {
        "dateStartStatus": {
            "columns": ["dateStart", "status"]
        },
        "dateEndStatus": {
            "columns": ["dateEnd", "status"]
        },
        "dateStart": {
            "columns": ["dateStart", "deleted"]
        },
        "status": {
            "columns": ["status", "deleted"]
        },
        "assignedUser": {
            "columns": ["assignedUserId", "deleted"]
        },
        "assignedUserStatus": {
            "columns": ["assignedUserId", "status"]
        }
    },
    "repositoryClassName": "Espo\\Core\\Repositories\\Event",
    "optimisticConcurrencyControl": true
}
