Optimal design of diamond-air microcavities for quantum networks using an analytical approach