{
  "id": "HS-003",
  "name": "HubSpot inbound should not overwrite NexusCRM authoritative data",
  "description": "When a Lead with the same Email already exists in NexusCRM, HubSpot pushing the same record should not overwrite existing authoritative fields (LastName, Company, etc.). Bug: #574 - HubSpot inbound overwrites Nexus authoritative data.",
  "object": "HubSpotInbound",
  "method": "POST",
  "endpoint": "/services/integrations/hubspot/webhook",
  "payload": {
    "email": "hubspot-authoritative@test.com",
    "firstName": "Original",
    "lastName": "Authoritative Lead",
    "company": "Original Company",
    "website": "https://original.com",
    "hubspot_id": "hs_900003"
  },
  "expects": {
    "status_code": 201
  },
  "setup": {
    "object": "Lead",
    "method": "POST",
    "endpoint": "/services/data/v63.0/sobjects/Lead",
    "payload": {
      "LastName": "Existing LastName",
      "Company": "Existing Company Name",
      "Email": "hubspot-authoritative@test.com",
      "Status": "WORKING"
    }
  },
  "query_after": {
    "object": "Lead",
    "assertions": [
      {
        "field": "LastName",
        "operator": "eq",
        "value": "Existing LastName"
      },
      {
        "field": "Company",
        "operator": "eq",
        "value": "Existing Company Name"
      },
      {
        "field": "Status",
        "operator": "eq",
        "value": "WORKING"
      }
    ]
  },
  "teardown": {
    "method": "DELETE",
    "endpoint": "/services/data/v63.0/sobjects/Lead/{id}"
  },
  "priority": "P0",
  "bug_ref": "#574",
  "scene": "hubspot"
}
