{% if scaladoc %}
{{ scaladoc }}
{% endif %}
enum {{ name }} {
{% for value in values %}
{% if value.description or value.meaning %}
  /**
{% if value.description %}
   * {{ value.description }}
{% endif %}
{% if value.meaning %}
   * @see {{ value.meaning }}
{% endif %}
   */
{% endif %}
  case {{ value.name }}
{% endfor %}
}
{% if codecs == "inline" %}

object {{ name }} {
  implicit val decoder: Decoder[{{ name }}] =
    Decoder.decodeString.emap {
{% for value in values %}
      case "{{ value.linkml_name }}" => Right({{ name }}.{{ value.name }})
{% endfor %}
      case other => Left(s"Unknown {{ name }}: $other")
    }

  implicit val encoder: Encoder[{{ name }}] =
    Encoder.encodeString.contramap {
{% for value in values %}
      case {{ name }}.{{ value.name }} => "{{ value.linkml_name }}"
{% endfor %}
    }

  def fromJson(json: String): Either[io.circe.Error, {{ name }}] =
    io.circe.parser.decode[{{ name }}](json)
  def toJson(instance: {{ name }}): String =
    encoder(instance).noSpaces
}
{% endif %}
