package net.pokeranalytics.android.ui.activity

import android.content.Context
import android.content.Intent
import android.os.Bundle
import kotlinx.android.synthetic.main.activity_calendar_details.*
import net.pokeranalytics.android.R
import net.pokeranalytics.android.calculus.ComputedResults
import net.pokeranalytics.android.model.filter.QueryCondition
import net.pokeranalytics.android.ui.activity.components.PokerAnalyticsActivity
import net.pokeranalytics.android.ui.fragment.CalendarDetailsFragment


class CalendarDetailsActivity : PokerAnalyticsActivity() {

	companion object {

		var computedResults: ComputedResults? = null
		var sessionTypeCondition: QueryCondition? = null
		var detailsTitle: String? = null

		/**
		 * Default constructor
		 */
		fun newInstance(context: Context, computedResults: ComputedResults, sessionTypeCondition: QueryCondition?, title: String?) {
			this.computedResults = computedResults
			this.sessionTypeCondition = sessionTypeCondition
			this.detailsTitle = title
			val intent = Intent(context, CalendarDetailsActivity::class.java)
			context.startActivity(intent)
		}

	}

	override fun onCreate(savedInstanceState: Bundle?) {
		super.onCreate(savedInstanceState)
		setContentView(R.layout.activity_calendar_details)
		initUI()
	}

	/**
	 * Init UI
	 */
	private fun initUI() {

		val calendarDetailsFragment = calendarDetailsFragment as CalendarDetailsFragment
		calendarDetailsFragment.setData(computedResults, sessionTypeCondition, detailsTitle)

	}

}
