title: Scala: How to get Enumeration element based on values and labels?
body: <p>I have two enum classes defined as the following.</p>
  
  <pre><code>object Rating extends Enumeration {
    type Rating = Value
    val LOW: Value = Value("Low")
    val AVERAGE: Value = Value("Average")
    val HIGH: Value = Value("High")
  }
  
  object Reason extends Enumeration {
    type Reason = Value
    val MISSING_PARTS: Value = Value(1)
    val WRONG_ITEM: Value = Value(2)
    val DEFECTIVE_ITEM: Value = Value(3)
  }
  </code></pre>
  
  <ol>
  <li><p>How can I get the Rating based on the String values "Low", "Average" and "High"</p></li>
  <li><p>How can I get the Reason based on the Integer values 1, 2, 3</p></li>
  <li><p>How can I get the Reason based on the val name MISSING_PARTS, WRONG_ITEM, DEFECTIVE_ITEM</p></li>
  </ol>
  
  <p>Please correct me if I am not using the correct terminology. I am from Java background and new to Scala. I did a lot of searches but either they are outdated or they use very trivial examples where the labels and values are the same strings, which does not help much.</p>
  
  <p>Any help will be appreciated.</p>