A model of foreshock occurrence