All Downloads are FREE. Search and download functionalities are using the official Maven repository.

lucuma.core.enums.GcalArc.scala Maven / Gradle / Ivy

There is a newer version: 0.108.0
Show newest version
// Copyright (c) 2016-2023 Association of Universities for Research in Astronomy, Inc. (AURA)
// For license information see LICENSE or https://opensource.org/licenses/BSD-3-Clause

package lucuma
package core
package enums
import cats.syntax.eq.*
import lucuma.core.util.Enumerated

/**
 * Enumerated type for calibration unit arc lamps.
 * @group Enumerations (Generated)
 */
sealed abstract class GcalArc(
  val tag: String,
  val shortName: String,
  val longName: String,
  val obsolete: Boolean
) extends Product with Serializable

object GcalArc {

  /** @group Constructors */ case object ArArc extends GcalArc("ArArc", "Ar arc", "Ar arc", false)
  /** @group Constructors */ case object ThArArc extends GcalArc("ThArArc", "ThAr arc", "ThAr arc", false)
  /** @group Constructors */ case object CuArArc extends GcalArc("CuArArc", "CuAr arc", "CuAr arc", false)
  /** @group Constructors */ case object XeArc extends GcalArc("XeArc", "Xe arc", "Xe arc", false)

  /** All members of GcalArc, in canonical order. */
  val all: List[GcalArc] =
    List(ArArc, ThArArc, CuArArc, XeArc)

  /** Select the member of GcalArc with the given tag, if any. */
  def fromTag(s: String): Option[GcalArc] =
    all.find(_.tag === s)

  /** Select the member of GcalArc with the given tag, throwing if absent. */
  def unsafeFromTag(s: String): GcalArc =
    fromTag(s).getOrElse(throw new NoSuchElementException(s"GcalArc: Invalid tag: '$s'"))

  /** @group Typeclass Instances */
  implicit val GcalArcEnumerated: Enumerated[GcalArc] =
    new Enumerated[GcalArc] {
      def all = GcalArc.all
      def tag(a: GcalArc) = a.tag
      override def unsafeFromTag(s: String): GcalArc =
        GcalArc.unsafeFromTag(s)
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy