refactor `Constraint` API and label codes
refactor `Mapping` implements to immutable