Two-photon absorption in two-dimensional materials: The case of hexagonal boron nitride