Design of terahertz quantum-well photodetectors