{
  "id": "SDR-008",
  "name": "Lead Status transition: OPEN to Working updates Date_Status_Changed__c",
  "description": "When Lead Status transitions from OPEN to Working, Date_Status_Changed__c (DSC) should be populated with the transition timestamp. This verifies Bug B2: DSC not updated on status change.",
  "variables": {
    "test_lead_id": "00Q5g000001LC001AA0"
  },
  "object": "Lead",
  "method": "PATCH",
  "endpoint": "/services/data/v63.0/sobjects/Lead/{test_lead_id}",
  "payload": {
    "Status": "Working"
  },
  "expects": {
    "status_code": 204
  },
  "query_after": {
    "object": "Lead",
    "record_id": "{test_lead_id}",
    "assertions": [
      {
        "field": "Status",
        "operator": "eq",
        "value": "Working"
      },
      {
        "field": "Date_Status_Changed__c",
        "operator": "is_not_null",
        "value": true
      }
    ]
  },
  "setup": [
    {
      "type": "sql",
      "sql": "DELETE FROM `Lead` WHERE Id = '{test_lead_id}'",
      "expected_status": 200
    },
    {
      "type": "sql",
      "sql": "INSERT INTO `Lead` (Id, FirstName, LastName, Company, Status, Email, IsConverted) VALUES ('{test_lead_id}', 'Test', 'SDR008_Contact', 'SDR008Company', 'Open', 'sdr008@example.com', false)",
      "expected_status": 200
    }
  ],
  "priority": "P0",
  "bug_ref": "B2",
  "scene": "lead_status_timestamp"
}
