/** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.0.1-dev * User agent: apibuilder app.apibuilder.io/poole-solutions/questlog-api/0.0.1-dev/http4s_0_22 */ package solutions.poole.questlog.api.v0.models { /** * @param guid primary key */ trait DatabaseRecord { def guid: _root_.java.util.UUID } sealed trait Person extends _root_.scala.Product with _root_.scala.Serializable { def personDiscriminator: PersonDiscriminator def email: _root_.scala.Option[String] def name: _root_.scala.Option[String] } /** * Defines the valid discriminator values for the type Person */ sealed trait PersonDiscriminator extends _root_.scala.Product with _root_.scala.Serializable object PersonDiscriminator { case object Guest extends PersonDiscriminator { override def toString = "guest" } case object User extends PersonDiscriminator { override def toString = "user" } final case class UNDEFINED(override val toString: String) extends PersonDiscriminator val all: scala.List[PersonDiscriminator] = scala.List(Guest, User) private val byName: Map[String, PersonDiscriminator] = all.map(x => x.toString.toLowerCase -> x).toMap def apply(value: String): PersonDiscriminator = fromString(value).getOrElse(UNDEFINED(value)) def fromString(value: String): _root_.scala.Option[PersonDiscriminator] = byName.get(value.toLowerCase) } /** * Represents an adventure. */ final case class Adventure( override val guid: _root_.java.util.UUID, name: String, description: _root_.scala.Option[String] = None, location: _root_.scala.Option[String] = None, participants: _root_.scala.Option[Seq[solutions.poole.questlog.api.v0.models.Participant]] = None, packLists: _root_.scala.Option[Seq[solutions.poole.questlog.api.v0.models.Item]] = None ) extends DatabaseRecord /** * Represents a validation error from the application. */ final case class Error( code: String, message: String ) final case class Guest( override val email: _root_.scala.Option[String] = None, override val name: _root_.scala.Option[String] = None ) extends Person { override val personDiscriminator: PersonDiscriminator = PersonDiscriminator.Guest } final case class Item( name: String, size: _root_.scala.Option[Double] = None, description: _root_.scala.Option[String] = None, `type`: _root_.scala.Option[solutions.poole.questlog.api.v0.models.ItemType] = None ) /** * Represents a adventure participant and what items they will bring. */ final case class Participant( person: solutions.poole.questlog.api.v0.models.Person, items: _root_.scala.Option[Seq[solutions.poole.questlog.api.v0.models.Item]] = None ) final case class User( override val guid: _root_.java.util.UUID, override val email: _root_.scala.Option[String] = None, override val name: _root_.scala.Option[String] = None ) extends DatabaseRecord with Person { override val personDiscriminator: PersonDiscriminator = PersonDiscriminator.User } /** * Provides future compatibility in clients - in the future, when a type is added * to the union Person, it will need to be handled in the client code. This * implementation will deserialize these future types as an instance of this class. * * @param description Information about the type that we received that is undefined in this version of * the client. */ final case class PersonUndefinedType( description: String ) extends Person { override val personDiscriminator: PersonDiscriminator = PersonDiscriminator.UNDEFINED(description) override def email: _root_.scala.Option[String] = ??? override def name: _root_.scala.Option[String] = ??? } sealed trait ItemType extends _root_.scala.Product with _root_.scala.Serializable object ItemType { /** * Required to keep going */ case object Food extends ItemType { override def toString = "Food" } /** * Required to fend of nature */ case object Clothes extends ItemType { override def toString = "Clothes" } /** * Required for sleep */ case object Camp extends ItemType { override def toString = "Camp" } /** * Required for eating */ case object Utensils extends ItemType { override def toString = "Utensils" } /** * Required to perform the given activity */ case object Gear extends ItemType { override def toString = "Gear" } /** * UNDEFINED captures values that are sent either in error or * that were added by the server after this library was * generated. We want to make it easy and obvious to users of * this library to handle this case gracefully. * * We use all CAPS for the variable name to avoid collisions * with the camel cased values above. */ final case class UNDEFINED(override val toString: String) extends ItemType /** * all returns a list of all the valid, known values. We use * lower case to avoid collisions with the camel cased values * above. */ val all: scala.List[ItemType] = scala.List(Food, Clothes, Camp, Utensils, Gear) private val byName: Map[String, ItemType] = all.map(x => x.toString.toLowerCase -> x).toMap def apply(value: String): ItemType = fromString(value).getOrElse(UNDEFINED(value)) def fromString(value: String): _root_.scala.Option[ItemType] = byName.get(value.toLowerCase) } }