alloy.proto.Range.scala Maven / Gradle / Ivy
package alloy.proto
import smithy4s.Hints
import smithy4s.Schema
import smithy4s.ShapeId
import smithy4s.ShapeTag
import smithy4s.schema.Schema.int
import smithy4s.schema.Schema.struct
final case class Range(start: Int, end: Int)
object Range extends ShapeTag.Companion[Range] {
val id: ShapeId = ShapeId("alloy.proto", "Range")
val hints: Hints = Hints.empty
// constructor using the original order from the spec
private def make(start: Int, end: Int): Range = Range(start, end)
implicit val schema: Schema[Range] = struct(
int.required[Range]("start", _.start),
int.required[Range]("end", _.end),
)(make).withId(id).addHints(hints)
}