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

lucuma.core.enums.GpiSamplingMode.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 GPI Sampling Mode.
 * @group Enumerations (Generated)
 */
sealed abstract class GpiSamplingMode(
  val tag: String,
  val shortName: String,
  val longName: String,
  val obsolete: Boolean
) extends Product with Serializable

object GpiSamplingMode {

  /** @group Constructors */ case object FAST extends GpiSamplingMode("FAST", "Fast", "Fast", false)
  /** @group Constructors */ case object SINGLE_CDS extends GpiSamplingMode("SINGLE_CDS", "Single CDS", "Single CDS", false)
  /** @group Constructors */ case object MULTIPLE_CDS extends GpiSamplingMode("MULTIPLE_CDS", "Multiple CDS", "Multiple CDS", false)
  /** @group Constructors */ case object UTR extends GpiSamplingMode("UTR", "UTR", "UTR", false)

  /** All members of GpiSamplingMode, in canonical order. */
  val all: List[GpiSamplingMode] =
    List(FAST, SINGLE_CDS, MULTIPLE_CDS, UTR)

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

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

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

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy