Euclid: III. The NISP instrument