{
  "id": "RB-003",
  "name": "Purge recycle-bin row by entry id",
  "description": "Purging a soft-deleted record should use the recycle-bin entry id, physically delete the backing Account row, and remove the recycle-bin entry.",
  "scene": "recycle_bin",
  "object": "RecycleBin",
  "method": "DELETE",
  "endpoint": "/services/data/v63.0/recyclebin/{recycle_bin_entry_id}",
  "setup": [
    {
      "name": "Create soft-deleted Account for recycle-bin purge",
      "type": "sql",
      "sql": "INSERT INTO Account (Id, Name, IsDeleted) VALUES ('001RB003', 'Recycle Purge Account', 1) ON DUPLICATE KEY UPDATE Name=VALUES(Name), IsDeleted=VALUES(IsDeleted)",
      "id_var": "seed_account_id",
      "id_value": "001RB003",
      "object": "Account"
    },
    {
      "name": "Create recycle-bin entry for purge",
      "type": "sql",
      "sql": "INSERT INTO _System_RecycleBin (Id, RecordId, ObjectApiName, RecordName, DeletedBy, DeletedDate, CreatedDate, LastModifiedDate) VALUES ('rb-003-entry', '001RB003', 'Account', 'Recycle Purge Account', '10000000-0000-0000-0000-000000000001', NOW(), NOW(), NOW()) ON DUPLICATE KEY UPDATE RecordId=VALUES(RecordId), ObjectApiName=VALUES(ObjectApiName), RecordName=VALUES(RecordName), DeletedBy=VALUES(DeletedBy), DeletedDate=VALUES(DeletedDate), LastModifiedDate=VALUES(LastModifiedDate)",
      "id_var": "recycle_bin_entry_id",
      "id_value": "rb-003-entry",
      "object": "_System_RecycleBin"
    }
  ],
  "expects": {
    "status_code": 204
  },
  "query_after": {
    "object": "_System_RecycleBin",
    "id_field": "RecordId",
    "record_id": "{seed_account_id}",
    "response_assertions": [
      {
        "field": "totalSize",
        "operator": "equals",
        "value": 0
      }
    ]
  },
  "teardown": [
    {
      "type": "sql",
      "sql": "DELETE FROM _System_RecycleBin WHERE Id = 'rb-003-entry'"
    },
    {
      "type": "sql",
      "sql": "DELETE FROM Account WHERE Id = '001RB003'"
    }
  ],
  "priority": "P1"
}
