case class encapsulation