Bifurcations in piecewise-smooth dynamical systems: Theory and Applications