/** * Generated by API Builder - https://www.apibuilder.io * Service version: 0.0.1 * User agent: apibuilder app.apibuilder.io/faberoh/order-api/0.0.1/http4s_0_18 */ package com.faberoh.order.api.v0.models { /** * An address * * @param firstName The first name. * @param lastName The last name. * @param line1 The first line of the address. * @param line2 The second line of the address. * @param zip The zip code. * @param city The city name. * @param state The state name. * @param countryCode The country ISO code. */ final case class Address( firstName: String, lastName: String, line1: String, line2: _root_.scala.Option[String] = None, zip: String, city: String, state: String, countryCode: String ) /** * A credit card. * * @param number The credit card number. * @param expirationMonth The credit card expiration month. * @param expirationYear The credit card expiration year. * @param securityCode The credit card security code. * @param brand The credit card brand. * @param holderName The credit card holder name. */ final case class CreditCard( number: String, expirationMonth: Int, expirationYear: Int, securityCode: String, brand: com.faberoh.order.api.v0.models.CreditCardBrand, holderName: String ) /** * An item of the order. * * @param upc The UPC code for the product. * @param quantity The quantity of this item in the order. */ final case class Item( upc: String, quantity: Int ) /** * A customer order * * @param id The order unique identifier. * @param user The customer info. * @param status The current status of the order. * @param items The items of the order. * @param billingAddress The billing address of the order. * @param shippingAddress The shipping address of the order. * @param creditCard The payment method used. * @param summary the order summary amounts */ final case class Order( id: _root_.java.util.UUID, user: com.faberoh.order.api.v0.models.User, status: com.faberoh.order.api.v0.models.OrderStatus, items: Seq[com.faberoh.order.api.v0.models.Item], billingAddress: com.faberoh.order.api.v0.models.Address, shippingAddress: com.faberoh.order.api.v0.models.Address, creditCard: com.faberoh.order.api.v0.models.CreditCard, summary: com.faberoh.order.api.v0.models.OrderSummary ) /** * An item of the order. * * @param itemsTotal The total cost of the items in the order. * @param shippingCharge The charge for shipping the order. * @param taxes The taxes amount. * @param total The total amount. */ final case class OrderSummary( itemsTotal: Int, shippingCharge: Int, taxes: Int, total: Int ) /** * Customer info. * * @param id The unique ID for the user. * @param email The customer's email address. */ final case class User( id: _root_.java.util.UUID, email: String ) /** * The credit card brands supported. */ sealed trait CreditCardBrand extends _root_.scala.Product with _root_.scala.Serializable object CreditCardBrand { case object Visa extends CreditCardBrand { override def toString = "visa" } case object Mastercard extends CreditCardBrand { override def toString = "mastercard" } case object Amex extends CreditCardBrand { override def toString = "amex" } /** * 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 for 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 CreditCardBrand /** * 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[CreditCardBrand] = scala.List(Visa, Mastercard, Amex) private val byName: Map[String, CreditCardBrand] = all.map(x => x.toString.toLowerCase -> x).toMap def apply(value: String): CreditCardBrand = fromString(value).getOrElse(UNDEFINED(value)) def fromString(value: String): _root_.scala.Option[CreditCardBrand] = byName.get(value.toLowerCase) } /** * The processing status of an order. */ sealed trait OrderStatus extends _root_.scala.Product with _root_.scala.Serializable object OrderStatus { case object Open extends OrderStatus { override def toString = "open" } case object Submitted extends OrderStatus { override def toString = "submitted" } case object Processed extends OrderStatus { override def toString = "processed" } case object Shipped extends OrderStatus { override def toString = "shipped" } case object Cancelled extends OrderStatus { override def toString = "cancelled" } case object Returned extends OrderStatus { override def toString = "returned" } /** * 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 for 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 OrderStatus /** * 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[OrderStatus] = scala.List(Open, Submitted, Processed, Shipped, Cancelled, Returned) private val byName: Map[String, OrderStatus] = all.map(x => x.toString.toLowerCase -> x).toMap def apply(value: String): OrderStatus = fromString(value).getOrElse(UNDEFINED(value)) def fromString(value: String): _root_.scala.Option[OrderStatus] = byName.get(value.toLowerCase) } }