{
    "fields": {
        "name": {
            "type": "varchar",
            "required": true,
            "view": "crm:views/document/fields/name",
            "pattern": "$noBadCharacters"
        },
        "file": {
            "type": "file",
            "required": true,
            "view": "crm:views/document/fields/file",
            "accept": [
                ".pdf",
                ".odt",
                ".ods",
                ".odp",
                ".docx",
                ".xlsx",
                ".pptx",
                ".doc",
                ".xls",
                ".ppt",
                ".rtf",
                ".csv",
                ".md",
                ".txt"
            ]
        },
        "status": {
            "type": "enum",
            "options": [
                "Draft",
                "Active",
                "Canceled",
                "Expired"
            ],
            "style": {
                "Active": "primary",
                "Canceled": "info",
                "Expired": "danger"
            },
            "displayAsLabel": true,
            "labelType": "state",
            "default": "Active",
            "audited": true,
            "fieldManagerAdditionalParamList": [
                {
                    "name": "activeOptions",
                    "view": "views/admin/field-manager/fields/not-actual-options"
                }
            ],
            "activeOptions": ["Active"],
            "customizationOptionsReferenceDisabled": true
        },
        "type": {
            "type": "enum",
            "options": ["", "Contract", "NDA", "EULA", "License Agreement"],
            "customizationOptionsReferenceDisabled": true
        },
        "publishDate": {
            "type": "date",
            "required": true,
            "default": "javascript: return this.dateTime.getToday();"
        },
        "expirationDate": {
            "type": "date",
            "after": "publishDate"
        },
        "description": {
            "type": "text"
        },
        "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",
            "view": "views/fields/assigned-user"
        },
        "teams": {
            "type": "linkMultiple",
            "view": "views/fields/teams"
        },
        "accounts": {
            "type": "linkMultiple",
            "importDisabled": true,
            "exportDisabled": true,
            "noLoad": true,
            "directUpdateDisabled": true,
            "layoutAvailabilityList": [
                "filters"
            ]
        },
        "folder": {
            "type": "link",
            "view": "views/fields/link-category-tree"
        }
    },
    "links": {
        "accounts": {
            "type": "hasMany",
            "entity": "Account",
            "foreign": "documents"
        },
        "opportunities": {
            "type": "hasMany",
            "entity": "Opportunity",
            "foreign": "documents"
        },
        "leads": {
            "type": "hasMany",
            "entity": "Lead",
            "foreign": "documents"
        },
        "contacts": {
            "type": "hasMany",
            "entity": "Contact",
            "foreign": "documents"
        },
        "createdBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "modifiedBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "assignedUser": {
            "type": "belongsTo",
            "entity": "User"
        },
        "teams": {
            "type": "hasMany",
            "entity": "Team",
            "relationName": "entityTeam",
            "layoutRelationshipsDisabled": true
        },
        "folder": {
            "type": "belongsTo",
            "foreign": "documents",
            "entity": "DocumentFolder"
        }
    },
    "collection": {
        "orderBy": "createdAt",
        "order": "desc"
    }
}
