AdvertForUsedCar
and use scala Either to wrap them into different return cases. (at the end of the day the only thing that will change will be the validation).
We also need a base AdvertTrait that implements all the shared methods, such as validate (or maybe not validate since if the object is created the data must be valid already), perhaps as a object companion static method without implementation.
http://stackoverflow.com/questions/36635128/how-can-i-generalize-either-to-more-and-recursive-types
We need to have 2 case classes:
We also need a base
AdvertTrait
that implements all the shared methods, such as validate (or maybe not validate since if the object is created the data must be valid already), perhaps as a object companion static method without implementation.