title: Kotlin - Data class type String or some Object
body: <p>Say I have this data class in Kotlin:</p>
  
  <pre><code>@Document(collection = Approval.COLLECTION)
  data class Approval(
      @Id
      val id: String,
      val detailId: &lt;UNSURE HERE&gt;
  ) {
      companion object {
          const val COLLECTION: String = "approval"
      }
  }
  </code></pre>
  
  <p>That <code>detailID</code> can either be a <code>String</code> or an object like so:</p>
  
  <pre><code>data class AIDConfiguration(
      val sId: String,
      val cId: String
  )
  </code></pre>
  
  <p>However how do go about setting that type - as I can't use something like</p>
  
  <pre><code>val detailId: AIDConfiguration | String
  </code></pre>
  
  <p>I thought maybe make an interface, but not sure any syntax of getting that to be just a String</p>
  
  <pre><code>interface ParentConfiguration
  
  data class AIDConfiguration(
      val sId: String,
      val cId: String
  ): ParentConfiguration
  
  </code></pre>
  
  <p>And then</p>
  
  <pre><code>val detailId: ParentConfiguration
  </code></pre>
  
  <p>Any help appreciated.</p>
  
  <p>Thanks.</p>