rcdbquery/src/main/kotlin/de/pheerai/rcdbquery/dataMappings/Order.kt
Oliver Rümpelein d8412c32f2 Add more search types:
- Classification
 - Status
 - Make some `order` params invisible for `all` params
 - Solved some order types
2020-04-30 16:30:16 +02:00

60 lines
2.2 KiB
Kotlin

package de.pheerai.rcdbquery.dataMappings
import de.pheerai.rcdbquery.dsl.RcdbQueryParamsBuilder
@Suppress("unused")
enum class Order(
override val prettyName: String,
override val fullName: String,
override val paramValue: Int,
override val relevantForAll: Boolean = false
) : RcdbParamOption<Int>, RelevantForAll {
IMAGES("Images", "Amount of Images", 0),
NAME("Name", "Name of the Coaster", 1),
AKA("AKA", "Is/was also known as", 2, relevantForAll = false),
LOCATION("Location", 3),
PARK("Park", 4),
OPENED("Opened", "Opening Date", 8),
CLOSED("Closed", "Closing Date (past)", 9),
@Deprecated(
"This field seems to have been deprecated in favor of another parameter",
level = DeprecationLevel.WARNING,
replaceWith = ReplaceWith("Order.STATE")
)
STATE_2("State", "Operational State (legacy)", 10, relevantForAll = true),
ENTERED("Entered", 12),
TYPE("Type", "Construction Type (Wood, Steel)", 13),
DESIGN("Design", "Train Design (Sit-Down, Invert,...)", 14),
CLASSIFICATION("Classification", "Coaster Classification (Coaster, Powered Coaster, Mountain Coaster)", 15),
LAYOUT("Layout", 16),
MODEL("Model", "Manufacturer Model", 17),
MODEL_LINE("Model-Line", "Coaster Model Line", 18),
SPEED("Speed", "Max. Speed", 19),
HEIGHT("Height", 20),
DROP("Drop", "Highest Drop", 21),
LENGTH("Length", 22),
ANGLE("Angle", 23),
INVERSIONS("Inversions", "Number of inversions", 24),
SERIAL_NO("Serial", "Serial number", 25, relevantForAll = false),
SCALE("Scale", "Thrill factor", 26),
RIDE_TIME("Ride Time", 27),
STATUS("Status", "Operational state", 29),
MANUFACTURER("Manufacturer", 30),
CLOSING("Closing", "(Future) closign date for temporary installations", 31)
;
constructor(name: String, paramId: Int, deprecated: Boolean = false) : this(name, name, paramId)
companion object {
const val staticParamName = "order"
}
}
fun RcdbQueryParamsBuilder.sortBy(body: OrderBuilder.() -> OrderBuilder): RcdbQueryParamsBuilder {
val builder = OrderBuilder()
builder.body()
this[Order.staticParamName] = builder.build()
return this
}