package net.pokeranalytics.android.ui.view.rowrepresentable

import net.pokeranalytics.android.R
import net.pokeranalytics.android.ui.view.RowRepresentable
import net.pokeranalytics.android.ui.view.RowViewType


/*
enum class FilterCategoryRow(override val resId: Int?, val subCategories:Array<out RowRepresentable>, override val viewType: Int = RowViewType.TITLE_VALUE_ARROW.ordinal) : RowRepresentable {
	GENERAL(R.string.general, GeneralSubCategory.values()),
	DATE,
	DURATION,
	SESSION,
	CASH,
	TOURNAMENT,
	ONLINE,
	RESULT,
	TRANSACTION_TYPES,

	// Title Custom fields
	LOCATION,
	BANKROLL,
	PLAYERS;

	private enum class GeneralSubCategory(val category : FilterCategoryRow = GENERAL): RowRepresentable {
		CASH_TOURNAMENT,
		LIVE_ONLINE,
		GAME,
		LIMIT_TYPE,
		TABLE_SIZE,
	}
 */
enum class FilterCategoryRow : RowRepresentable {

	GENERAL,
	DATE,
	DURATION,
	SESSION,
	CASH,
	TOURNAMENT,
	ONLINE,
	RESULT,
	TRANSACTION_TYPES,

	// Title Custom fields
	LOCATION,
	BANKROLL,
	PLAYERS;

	override val resId: Int?
		get() {
			return when (this) {
				GENERAL -> R.string.general
				DATE -> R.string.date
				DURATION -> R.string.duration
				SESSION -> R.string.session
				CASH -> R.string.cash
				TOURNAMENT -> R.string.tournament
				ONLINE -> R.string.online
				RESULT -> R.string.result
				TRANSACTION_TYPES -> R.string.operation_types
				LOCATION -> R.string.location
				BANKROLL -> R.string.bankroll
				PLAYERS -> R.string.players
			}
		}

	override val viewType: Int
		get() {
			return when (this) {
				GENERAL, DATE, DURATION, SESSION, CASH, TOURNAMENT, ONLINE, RESULT, TRANSACTION_TYPES,
				LOCATION, BANKROLL, PLAYERS -> RowViewType.TITLE_VALUE_ARROW.ordinal
			}
		}

	/**
	 * Get subcategories of filters
	 */
	fun getSubcategories(): ArrayList<FilterSubcategoryRow> {
		val subcategories = ArrayList<FilterSubcategoryRow>()

		when (this) {
			GENERAL -> subcategories.addAll(
				arrayListOf(
					FilterSubcategoryRow.CASH_TOURNAMENT, FilterSubcategoryRow.LIVE_ONLINE, FilterSubcategoryRow.GAME,
					FilterSubcategoryRow.LIMIT_TYPE, FilterSubcategoryRow.TABLE_SIZE
				)
			)
			DATE -> subcategories.addAll(
				arrayListOf(
					FilterSubcategoryRow.DYNAMIC_DATE, FilterSubcategoryRow.FIXED_DATE, FilterSubcategoryRow.DURATION, FilterSubcategoryRow.YEAR,
					FilterSubcategoryRow.WEEKDAYS_OR_WEEKEND, FilterSubcategoryRow.DAY_OF_WEEK, FilterSubcategoryRow.MONTH_OF_YEAR
				)
			)
			DURATION -> subcategories.addAll(arrayListOf(FilterSubcategoryRow.SESSION_DURATION, FilterSubcategoryRow.RANGE))
			SESSION -> subcategories.addAll(arrayListOf())
			CASH -> subcategories.addAll(arrayListOf(FilterSubcategoryRow.BLINDS, FilterSubcategoryRow.CASH_RE_BUY_COUNT))
			TOURNAMENT -> subcategories.addAll(
				arrayListOf(
					FilterSubcategoryRow.TOURNAMENT_TYPE, FilterSubcategoryRow.COMPLETION_PERCENTAGE, FilterSubcategoryRow.PLACE,
					FilterSubcategoryRow.PLAYERS_COUNT, FilterSubcategoryRow.TOURNAMENT_RE_BUY_COUNT, FilterSubcategoryRow.BUY_IN
				)
			)
			ONLINE -> subcategories.addAll(arrayListOf(FilterSubcategoryRow.MULTI_TABLING))
			RESULT -> subcategories.addAll(arrayListOf(FilterSubcategoryRow.VALUE))
			TRANSACTION_TYPES -> subcategories.addAll(arrayListOf())
			LOCATION -> subcategories.addAll(arrayListOf(FilterSubcategoryRow.LOCATION))
			BANKROLL -> subcategories.addAll(arrayListOf(FilterSubcategoryRow.BANKROLL))
			PLAYERS -> subcategories.addAll(arrayListOf(FilterSubcategoryRow.NUMBER_OF_PLAYERS, FilterSubcategoryRow.MULTI_PLAYER))

		}

		return subcategories
	}


}