{
    "fields": {
        "name": {
            "type": "varchar",
            "maxLength": 249,
            "required": true,
            "pattern": "$noBadCharacters",
            "audited": true
        },
        "website": {
            "type": "url",
            "strip": true
        },
        "emailAddress": {
            "type": "email",
            "isPersonalData": true
        },
        "phoneNumber": {
            "type": "phone",
            "typeList": ["Office", "Mobile", "Fax", "Other"],
            "defaultType": "Office"
        },
        "type": {
            "type": "enum",
            "options": ["", "Customer", "Investor", "Partner", "Reseller"],
            "customizationOptionsReferenceDisabled": true,
            "audited": true
        },
        "industry": {
            "type": "enum",
            "options": [
                "",
                "Advertising",
                "Aerospace",
                "Agriculture",
                "Apparel & Accessories",
                "Architecture",
                "Automotive",
                "Banking",
                "Biotechnology",
                "Building Materials & Equipment",
                "Chemical",
                "Construction",
                "Consulting",
                "Computer",
                "Culture",
                "Creative",
                "Defense",
                "Education",
                "Electronics",
                "Electric Power",
                "Energy",
                "Entertainment & Leisure",
                "Finance",
                "Food & Beverage",
                "Grocery",
                "Healthcare",
                "Hospitality",
                "Insurance",
                "Legal",
                "Manufacturing",
                "Mass Media",
                "Marketing",
                "Mining",
                "Music",
                "Publishing",
                "Petroleum",
                "Real Estate",
                "Retail",
                "Service",
                "Sports",
                "Software",
                "Support",
                "Shipping",
                "Travel",
                "Technology",
                "Telecommunications",
                "Television",
                "Transportation",
                "Testing, Inspection & Certification",
                "Venture Capital",
                "Wholesale",
                "Water"
            ],
            "isSorted": true,
            "customizationOptionsReferenceDisabled": true
        },
        "sicCode": {
            "type": "varchar",
            "maxLength": 40,
            "pattern": "$noBadCharacters",
            "noSpellCheck": true
        },
        "contactRole": {
            "type": "varchar",
            "notStorable": true,
            "utility": true,
            "orderDisabled": true,
            "maxLength": 100,
            "pattern": "$noBadCharacters",
            "layoutMassUpdateDisabled": true,
            "layoutListDisabled": true,
            "layoutDetailDisabled": true,
            "layoutSearchDisabled": true,
            "fieldManagerParamList": [
                "pattern"
            ]
        },
        "contactIsInactive": {
            "type": "bool",
            "notStorable": true,
            "orderDisabled": true,
            "default": false,
            "utility": true
        },
        "billingAddress": {
            "type": "address"
        },
        "billingAddressStreet": {
            "type": "text",
            "maxLength": 255,
            "dbType": "varchar"
        },
        "billingAddressCity": {
            "type": "varchar"
        },
        "billingAddressState": {
            "type": "varchar"
        },
        "billingAddressCountry": {
            "type": "varchar"
        },
        "billingAddressPostalCode": {
            "type": "varchar"
        },
        "shippingAddress": {
            "type": "address",
            "view": "crm:views/account/fields/shipping-address"
        },
        "shippingAddressStreet": {
            "type": "text",
            "maxLength": 255,
            "dbType": "varchar"
        },
        "shippingAddressCity": {
            "type": "varchar"
        },
        "shippingAddressState": {
            "type": "varchar"
        },
        "shippingAddressCountry": {
            "type": "varchar"
        },
        "shippingAddressPostalCode": {
            "type": "varchar"
        },
        "description": {
            "type": "text"
        },
        "campaign": {
            "type": "link"
        },
        "isLocked": {
            "type": "bool",
            "readOnly": true,
            "audited": true,
            "layoutAvailabilityList": [
                "filters",
                "list"
            ]
        },
        "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",
            "notLockable": true
        },
        "teams": {
            "type": "linkMultiple",
            "view": "views/fields/teams",
            "notLockable": true
        },
        "targetLists": {
            "type": "linkMultiple",
            "layoutDetailDisabled": true,
            "layoutListDisabled": true,
            "importDisabled": true,
            "exportDisabled": true,
            "directAccessDisabled": true,
            "directUpdateEnabled": true,
            "filtersEnabled": true,
            "noLoad": true
        },
        "targetList": {
            "type": "link",
            "notStorable": true,
            "orderDisabled": true,
            "layoutDetailDisabled": true,
            "layoutListDisabled": true,
            "layoutMassUpdateDisabled": true,
            "layoutFiltersDisabled": true,
            "entity": "TargetList",
            "directAccessDisabled": true,
            "importEnabled": true
        },
        "originalLead": {
            "type": "linkOne",
            "readOnly": true,
            "view": "views/fields/link-one"
        },
        "targetListIsOptedOut": {
            "type": "bool",
            "notStorable": true,
            "orderDisabled": true,
            "readOnly": true,
            "utility": true
        }
    },
    "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
        },
        "contacts": {
            "type": "hasMany",
            "entity": "Contact",
            "foreign": "accounts",
            "columnAttributeMap": {
                "role": "contactRole",
                "isInactive": "contactIsInactive"
            }
        },
        "contactsPrimary": {
            "type": "hasMany",
            "entity": "Contact",
            "foreign": "account",
            "layoutRelationshipsDisabled": true
        },
        "opportunities": {
            "type": "hasMany",
            "entity": "Opportunity",
            "foreign": "account"
        },
        "cases": {
            "type": "hasMany",
            "entity": "Case",
            "foreign": "account"
        },
        "documents": {
            "type": "hasMany",
            "entity": "Document",
            "foreign": "accounts",
            "audited": true
        },
        "meetingsPrimary": {
            "type": "hasMany",
            "entity": "Meeting",
            "foreign": "account",
            "layoutRelationshipsDisabled": true
        },
        "emailsPrimary": {
            "type": "hasMany",
            "entity": "Email",
            "foreign": "account",
            "layoutRelationshipsDisabled": true
        },
        "callsPrimary": {
            "type": "hasMany",
            "entity": "Call",
            "foreign": "account",
            "layoutRelationshipsDisabled": true
        },
        "tasksPrimary": {
            "type": "hasMany",
            "entity": "Task",
            "foreign": "account",
            "layoutRelationshipsDisabled": true
        },
        "meetings": {
            "type": "hasChildren",
            "entity": "Meeting",
            "foreign": "parent",
            "audited": true
        },
        "calls": {
            "type": "hasChildren",
            "entity": "Call",
            "foreign": "parent",
            "audited": true
        },
        "tasks": {
            "type": "hasChildren",
            "entity": "Task",
            "foreign": "parent"
        },
        "emails": {
            "type": "hasChildren",
            "entity": "Email",
            "foreign": "parent",
            "layoutRelationshipsDisabled": true
        },
        "campaign": {
            "type": "belongsTo",
            "entity": "Campaign",
            "foreign": "accounts"
        },
        "campaignLogRecords": {
            "type": "hasChildren",
            "entity": "CampaignLogRecord",
            "foreign": "parent"
        },
        "targetLists": {
            "type": "hasMany",
            "entity": "TargetList",
            "foreign": "accounts",
            "columnAttributeMap": {
                "optedOut": "targetListIsOptedOut"
            }
        },
        "portalUsers": {
            "type": "hasMany",
            "entity": "User",
            "foreign": "accounts"
        },
        "originalLead": {
            "type": "hasOne",
            "entity": "Lead",
            "foreign": "createdAccount"
        }
    },
    "collection": {
        "orderBy": "createdAt",
        "order": "desc",
        "textFilterFields": ["name", "emailAddress"]
    },
    "indexes": {
        "createdAt": {
            "columns": ["createdAt", "deleted"]
        },
        "createdAtId": {
            "unique": true,
            "columns": ["createdAt", "id"]
        },
        "name": {
            "columns": ["name", "deleted"]
        },
        "assignedUser": {
            "columns": ["assignedUserId", "deleted"]
        }
    },
    "optimisticConcurrencyControl": true
}
