package xyz.etztech.stonks.dsl

import java.time.Instant
import org.jetbrains.exposed.sql.*
import org.jetbrains.exposed.sql.`java-time`.timestamp

object LiveStatistics : Table() {
    val playerId: Column<String> = varchar("PlayerId", 150)
    val type: Column<String> = varchar("Type", 150)
    val name: Column<String> = varchar("Name", 150)
    val value: Column<Long> = long("Value")
    val rank: Column<Int> = integer("Rank")

    override val primaryKey = PrimaryKey(playerId, type, name, name = "PK_playerId_type_name")
}

object Statistics : Table() {
    val playerId: Column<String> = varchar("PlayerId", 150)
    val type: Column<String> = varchar("Type", 150)
    val name: Column<String> = varchar("Name", 150)
    val timestamp: Column<Instant> = timestamp("Timestamp")
    val value: Column<Long> = long("Value")

    override val primaryKey =
            PrimaryKey(playerId, type, name, timestamp, name = "PK_playerId_type_name_timestamp")
}
