Design of a photonic enabled lab-on-chip for spectroscopy and sensing in the terahertz domain