{
    "fields": {
        "name": {
            "type": "personName"
        },
        "salutationName": {
            "type": "enum",
            "options": ["", "Mr.", "Mrs.", "Ms.", "Dr."]
        },
        "firstName": {
            "type": "varchar",
            "maxLength": 100,
            "default":""
        },
        "lastName": {
            "type": "varchar",
            "maxLength": 100,
            "required": true,
            "default":""
        },
        "title": {
            "type": "varchar",
            "maxLength": 100
        },
        "status": {
            "type": "enum",
            "options": ["New", "Assigned", "In Process", "Converted", "Recycled", "Dead"],
            "default": "New",
            "view": "Fields.EnumStyled",
            "style": {
                "Converted": "success",
                "Recycled": "danger",
                "Dead": "danger"
            },
            "audited": true
        },
        "source": {
            "type": "enum",
            "options": ["", "Call", "Email", "Existing Customer", "Partner", "Public Relations", "Web Site", "Campaign", "Other"],
            "default": ""
        },
        "opportunityAmount": {
            "type": "currency",
            "audited": true
        },
        "opportunityAmountConverted": {
            "type": "currencyConverted",
            "readOnly": true
        },
        "website": {
            "type": "url"
        },
        "address": {
            "type": "address"
        },
        "addressStreet": {
            "type": "text",
            "maxLength": 255,
            "dbType": "varchar"
        },
        "addressCity": {
            "type": "varchar"
        },
        "addressState": {
            "type": "varchar"
        },
        "addressCountry": {
            "type": "varchar"
        },
        "addressPostalCode": {
            "type": "varchar"
        },
        "emailAddress": {
            "type": "email"
        },
        "phoneNumber": {
            "type": "phone",
            "typeList": ["Mobile", "Office", "Home", "Fax", "Other"],
            "defaultType": "Mobile"
        },
        "doNotCall": {
            "type": "bool"
        },
        "description": {
            "type": "text"
        },
        "createdAt": {
            "type": "datetime",
            "readOnly": true
        },
        "modifiedAt": {
            "type": "datetime",
            "readOnly": true
        },
        "createdBy": {
            "type": "link",
            "readOnly": true
        },
        "modifiedBy": {
            "type": "link",
            "readOnly": true
        },
        "accountName": {
            "type": "varchar"
        },
        "assignedUser": {
            "type": "link"
        },
        "acceptanceStatus": {
            "type": "varchar",
            "notStorable": true,
            "disabled": true
        },
        "teams": {
            "type": "linkMultiple"
        },
        "campaign": {
            "type": "link",
            "layoutListDisabled": true
        },
        "createdAccount": {
            "type": "link",
            "layoutDetailDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "createdContact": {
            "type": "link",
            "layoutDetailDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "createdOpportunity": {
            "type": "link",
            "layoutDetailDisabled": true,
            "layoutMassUpdateDisabled": true
        },
        "targetLists": {
            "type": "linkMultiple",
            "layoutDetailDisabled": true,
            "layoutListDisabled": true,
            "layoutMassUpdateDisabled": true,
            "importDisabled": true,
            "noLoad": true
        },
        "targetList": {
            "type": "link",
            "notStorable": true,
            "layoutDetailDisabled": true,
            "layoutListDisabled": true,
            "layoutMassUpdateDisabled": true,
            "layoutFiltersDisabled": true,
            "entity": "TargetList"
        }
    },
    "links": {
        "createdBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "modifiedBy": {
            "type": "belongsTo",
            "entity": "User"
        },
        "assignedUser": {
            "type": "belongsTo",
            "entity": "User"
        },
        "teams": {
            "type": "hasMany",
            "entity": "Team",
            "relationName": "entityTeam",
            "layoutRelationshipsDisabled": true
        },
        "opportunities": {
            "type": "hasMany",
            "entity": "Opportunity",
            "foreign": "leads"
        },
        "meetings": {
            "type": "hasMany",
            "entity": "Meeting",
            "foreign": "leads",
            "layoutRelationshipsDisabled": true
        },
        "calls": {
            "type": "hasMany",
            "entity": "Call",
            "foreign": "leads",
            "layoutRelationshipsDisabled": true
        },
        "tasks": {
            "type": "hasChildren",
            "entity": "Task",
            "foreign": "parent",
            "layoutRelationshipsDisabled": true
        },
        "emails": {
            "type": "hasChildren",
            "entity": "Email",
            "foreign": "parent",
            "layoutRelationshipsDisabled": true
        },
        "createdAccount": {
            "type": "belongsTo",
            "entity": "Account",
            "noJoin": true
        },
        "createdContact": {
            "type": "belongsTo",
            "entity": "Contact",
            "noJoin": true
        },
        "createdOpportunity": {
            "type": "belongsTo",
            "entity": "Opportunity",
            "noJoin": true
        },
        "campaign": {
            "type": "belongsTo",
            "entity": "Campaign",
            "foreign": "leads",
            "noJoin": true
        },
        "campaignLogRecords": {
            "type": "hasChildren",
            "entity": "CampaignLogRecord",
            "foreign": "parent"
        },
        "targetLists": {
            "type": "hasMany",
            "entity": "TargetList",
            "foreign": "leads"
        }
    },
    "convertEntityList": [
        "Account",
        "Contact",
        "Opportunity"
    ],
    "convertFields": {
        "Contact": {
        },
        "Account": {
            "name": "accountName",
            "billingAddressStreet": "addressStreet",
            "billingAddressCity": "addressCity",
            "billingAddressState": "addressState",
            "billingAddressPostalCode": "addressPostalCode",
            "billingAddressCountry": "addressCountry"
        },
        "Opportunity": {
            "amount": "opportunityAmount",
            "leadSource": "source"
        }
    },
    "collection": {
        "sortBy": "createdAt",
        "asc": false,
        "textFilterFields": ["name", "accountName"]
    },
    "indexes": {
        "firstName": {
            "columns": ["firstName", "deleted"]
        },
        "name": {
            "columns": ["firstName", "lastName"]
        },
        "status": {
            "columns": ["status", "deleted"]
        },
        "createdAt": {
            "columns": ["createdAt", "deleted"]
        },
        "createdAtStatus": {
            "columns": ["createdAt", "status"]
        },
        "assignedUser": {
            "columns": ["assignedUserId", "deleted"]
        },
        "assignedUserStatus": {
            "columns": ["assignedUserId", "status"]
        }
    }
}
