A patient with chronic serum sickness develops fever, joint pain, and a rash several days after receiving an injection of foreign serum proteins. Laboratory analysis reveals deposition of antigen–antibody complexes in small blood vessels and activation of complement. This condition is most consistent with which type of hypersensitivity reaction?