Text this: Necessary Optimality Conditions for a Class of Impulsive and Switching Systems