package net.pokeranalytics.android.model

import android.content.Context
import net.pokeranalytics.android.ui.view.RowRepresentable

enum class Limit : RowRepresentable {
	NO,
	POT,
	FIXED,
	SPREAD,
	MIXED;

	companion object {

		fun getInstance(value: String) : Limit? {
			return when (value) {
				"No Limit" -> NO
				"Pot Limit" -> POT
				"Fixed Limit", "Limit" -> FIXED
				"Mixed Limit" -> MIXED
				"Spread Limit" -> SPREAD
				else -> null
			}
		}

	}

	val shortName: String
		get() {
			return when (this) {
				NO -> "NL"
				POT -> "PL"
				FIXED -> "FL"
				MIXED -> "ML"
				SPREAD -> "SL"
			}
		}

	val longName: String
		get() {
			val limit = "Limit"
			return when (this) {
				NO -> "No $limit"
				POT -> "Pot $limit"
				FIXED -> "Fixed $limit"
				MIXED -> "Mixed $limit"
				SPREAD -> "Spread $limit"
			}
		}

	override fun getDisplayName(context: Context): String {
		return this.longName
	}

}