{
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "$id": "https://www.espocrm.com/schema/metadata/recordDefs.json",
    "title": "recordDefs",
    "description": "Record framework definitions for a scope.",
    "type": "object",
    "properties": {
        "duplicateWhereBuilderClassName": {
            "description": "A class for building a where clause for duplicate checking. Should implement Espo\\Core\\Duplicate\\WhereBuilder interface.",
            "type": "string"
        },
        "defaultsPopulatorClassName": {
            "description": "Populates default values when creating a record. Should implement Espo\\Core\\Record\\Defaults\\Populator. As of v8.2.",
            "type": "string"
        },
        "readLoaderClassNameList": {
            "description": "Classes to load additional fields for an entity. Should implement Espo\\Core\\FieldProcessing\\Loader interface.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "listLoaderClassNameList": {
            "description": "Classes to load additional fields for an entity for the list view. Should implement Espo\\Core\\FieldProcessing\\Loader interface.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "saverClassNameList": {
            "description": "Classes to save additional fields. Should implement Espo\\Core\\FieldProcessing\\Saver interface.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "selectApplierClassNameList": {
            "description": "Classes for additional handling of a select query. Should implement Espo\\Core\\Select\\Applier\\AdditionalApplier interface.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "actions": {
            "description": "Actions. E.g. merge, convertCurrency.",
            "type": "object",
            "additionalProperties": {
                "type": "object",
                "properties": {
                    "disabled": {
                        "description": "Disables the action.",
                        "type": "boolean"
                    },
                    "allowed": {
                        "description": "Allows the action for non-object scopes.",
                        "type": "boolean"
                    },
                    "implementationClassName": {
                        "description": "A class name, should implement Espo\\Core\\Action\\Action interface.",
                        "type": "string"
                    }
                }
            }
        },
        "massActions": {
            "description": "Mass actions. E.g. update, delete, convertCurrency, follow, unfollow, recalculateFormula.",
            "type": "object",
            "additionalProperties": {
                "type": "object",
                "properties": {
                    "disabled": {
                        "description": "Disables the action.",
                        "type": "boolean"
                    },
                    "allowed": {
                        "description": "Allows the action for non-object scopes.",
                        "type": "boolean"
                    },
                    "implementationClassName": {
                        "description": "A class name, should implement Espo\\Core\\MassAction\\MassAction interface.",
                        "type": "string"
                    }
                }
            }
        },
        "actionsDisabled": {
            "description": "Disable actions in the back-end.",
            "type": "boolean"
        },
        "massActionsDisabled": {
            "description": "Disable mass actions in the back-end.",
            "type": "boolean"
        },
        "exportDisabled": {
            "description": "Disable export regardless ACL.",
            "type": "boolean"
        },
        "actionHistoryDisabled": {
            "description": "Disable Action History processing. As of v8.2.",
            "type": "boolean"
        },
        "updateDuplicateCheck": {
            "description": "If true, then duplicate checking will be processed while updating a record.",
            "type": "boolean"
        },
        "forceSelectAllAttributes": {
            "type": "boolean",
            "description": "Always select all attributes when calling find. As of v8.2."
        },
        "mandatoryAttributeList": {
            "description": "Mandatory attributes to be selected when calling find. As of v8.2.",
            "type": "array",
            "items": {"type": "string"}
        },
        "duplicateLinkList": {
            "description": "Links to be copied when duplicating a record. As of v8.2.",
            "type": "array",
            "items": {"type": "string"}
        },
        "relationships": {
            "description": "Relationship parameters. Key-object pairs, where keys are link names.",
            "type": "object",
            "additionalProperties": {
                "type": "object",
                "description": "A link.",
                "properties": {
                    "countDisabled": {
                        "type": "boolean",
                        "description": "Disable total count. As of v8.2."
                    },
                    "selectAccessControlDisabled": {
                        "description": "Disable access control when listing related records; only access to a parent record will be checked.",
                        "type": "boolean"
                    },
                    "linkRequiredAccess": {
                        "description": "Access to a current record that is needed to be able to link and unlink records.",
                        "type": "string",
                        "enum": ["create", "read", "edit", "delete", "stream"]
                    },
                    "linkRequiredForeignAccess": {
                        "description": "Access to a foreign record that is needed to be able to link and unlink.",
                        "type": "string",
                        "enum": ["create", "read", "edit", "delete", "stream"]
                    },
                    "linkForeignAccessCheckDisabled": {
                        "description": "Disable foreign record access check when linking.",
                        "type": "boolean"
                    },
                    "linkCheckDisabled": {
                        "description": "Disable a link-check functionality when linking through link or link-multiple field.",
                        "type": "boolean"
                    },
                    "mandatoryAttributeList": {
                        "description": "Mandatory attributes to be selected when find related. As of v8.2.",
                        "type": "array",
                        "items": {"type": "string"}
                    },
                    "massLink": {
                        "type": "boolean",
                        "default": "Allow mass link. As of v8.2."
                    },
                    "linkOnlyNotLinked": {
                        "type": "boolean",
                        "description": "Allow linking only if a record is not linked with any. As of v8.3."
                    }
                }
            }
        },
        "loadAdditionalFieldsAfterUpdate": {
            "type": "boolean",
            "description": "Load additional fields after update. Needed for cases when additional fields need to be re-loaded since they are not actual after update."
        },
        "createInputFilterClassNameList": {
            "description": "Create input filters. Should implement Espo\\Core\\Record\\Input\\Filter. As of v8.2.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "updateInputFilterClassNameList": {
            "description": "Update input filters. Should implement Espo\\Core\\Record\\Input\\Filter. As of v8.2.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "outputFilterClassNameList": {
            "description": "Output filters. Should implement Espo\\Core\\Record\\Output\\Filter. As of v8.2.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "beforeReadHookClassNameList": {
            "description": "Before-read hooks. Should implement the Espo\\Core\\Record\\Hook\\ReadHook interface.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "beforeCreateHookClassNameList": {
            "description": "Before-create hooks. Should implement the Espo\\Core\\Record\\Hook\\CreateHook or Espo\\Core\\Record\\Hook\\SaveHook interface.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "afterCreateHookClassNameList": {
            "description": "After-create hooks. Should implement the Espo\\Core\\Record\\Hook\\CreateHook or Espo\\Core\\Record\\Hook\\SaveHook interface. As of v8.2.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "beforeUpdateHookClassNameList": {
            "description": "Before-update hooks. Should implement the Espo\\Core\\Record\\Hook\\UpdateHook or Espo\\Core\\Record\\Hook\\SaveHook interface.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "afterUpdateHookClassNameList": {
            "description": "Before-update hooks. Should implement the Espo\\Core\\Record\\Hook\\UpdateHook or Espo\\Core\\Record\\Hook\\SaveHook interface. As of v8.2.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "beforeDeleteHookClassNameList": {
            "description": "Before-delete hooks. Should implement the Espo\\Core\\Record\\Hook\\DeleteHook interface.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "afterDeleteHookClassNameList": {
            "description": "Before-delete hooks. Should implement the Espo\\Core\\Record\\Hook\\DeleteHook interface. As of v8.2.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "beforeLinkHookClassNameList": {
            "description": "Before-link hooks. Should implement the Espo\\Core\\Record\\Hook\\LinkHook interface.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "beforeUnlinkHookClassNameList": {
            "description": "Before-unlink hooks. Should implement the Espo\\Core\\Record\\Hook\\UnlinkHook interface.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "afterLinkHookClassNameList": {
            "description": "After-link hooks. Should implement the Espo\\Core\\Record\\Hook\\LinkHook interface. As of v8.2.",
            "type": "array",
            "items": {
                "type": "string"
            }
        },
        "afterUnlinkHookClassNameList": {
            "description": "After-unlink hooks. Should implement the Espo\\Core\\Record\\Hook\\UnlinkHook interface. As of v8.2.",
            "type": "array",
            "items": {
                "type": "string"
            }
        }
    }
}
