<@U0ZAWQLF6>: This works for me: ``` data class ...
# getting-started
w
@mrplow442: This works for me:
Copy code
data class Data(val id: Long, val type: Type, val title: String?, val value: ByteArray) {
        enum class Type(val id: Int) {
            Invalid(0),

            // content
            Photo(400),
            PhotoThumbnail(410),

            // URLs associated with content
            URLPhoto(10400),
            URLPhotoThumbnail(10410);

            companion object {
                fun forId(id: Number): Type {
                    val type = Type.values().find { it.id == id.toInt() }
                    if (type != null) {
                        return type
                    }
                    return Invalid
                }
            }
        }
    }
}