{
    "fields": {
        "post": {
            "type": "text"
        },
        "data": {
            "type": "jsonObject",
            "readOnly": true
        },
        "type": {
            "type": "varchar",
            "readOnly": true
        },
        "parent": {
            "type": "linkParent",
            "readOnly": true
        },
        "related": {
            "type": "linkParent",
            "readOnly": true
        },
        "attachments": {
            "type": "linkMultiple",
            "view": "Stream.Fields.AttachmentMultiple"
        },
        "number": {
            "type": "autoincrement",
            "index": true,
            "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"
        },
        "attachments": {
            "type": "hasChildren",
            "entity": "Attachment",
            "relationName": "attachments",
            "foreign": "parent"
        },
        "parent": {
            "type": "belongsToParent",
            "foreign": "notes"
        },
        "superParent": {
            "type": "belongsToParent"
        },
        "related": {
            "type": "belongsToParent"
        }
    },
    "collection": {
        "sortBy": "number",
        "asc": false
    },
    "streamRelated": {
        "Account": [
            "meetings",
            "calls",
            "tasks"
        ],
        "Contact": [
            "meetings",
            "calls",
            "tasks"
        ],
        "Lead": [
            "meetings",
            "calls",
            "tasks"
        ],
        "Opportunity": [
            "meetings",
            "calls",
            "tasks"
        ],
        "Case": [
            "meetings",
            "calls",
            "tasks"
        ]
    },
    "statusStyles": {
        "Lead": {
            "New" : "primary",
            "Assigned" : "primary",
            "In Process" : "primary",
            "Converted" : "success",
            "Recycled" : "danger",
            "Dead" : "danger"
        },
        "Case": {
            "New" : "primary",
            "Assigned" : "primary",
            "Pending" : "default",
            "Closed" : "success",
            "Rejected" : "danger",
            "Duplicate" : "danger"
        },
        "Opportunity": {
            "Prospecting": "primary",
            "Qualification": "primary",
            "Needs Analysis": "primary",
            "Value Proposition": "primary",
            "Id. Decision Makers": "primary",
            "Perception Analysis": "primary",
            "Proposal/Price Quote": "primary",
            "Negotiation/Review": "primary",
            "Closed Won" : "success",
            "Closed Lost" : "danger"
        },
        "Task": {
            "Completed": "success",
            "Started" : "primary",
            "Canceled" : "danger"
        },
        "Meeting": {
            "Held": "success"
        },
        "Call": {
        	"Held": "success"
        }
    },
    "statusFields": {
        "Lead": "status",
        "Case": "status",
        "Opportunity": "stage",
        "Task": "status",
        "Meeting": "status",
        "Call": "status",
        "Campaign": "status"
    },
    "indexes": {
        "createdAt": {
            "type": "index",
            "columns": ["createdAt"]
        },
        "parent": {
            "type": "index",
            "columns": ["parentId", "parentType"]
        },
        "parentAndSuperParent": {
            "type": "index",
            "columns": ["parentId", "parentType", "superParentId", "superParentType"]
        }
    }
}
