package net.pokeranalytics.android.model.utils

import io.realm.Realm
import net.pokeranalytics.android.model.realm.Session
import java.util.*

class SessionUtils {

	companion object {

		/**
		 * Returns true if the provided parameters doesn't correspond to an existing session
		 */
		fun unicityCheck(realm: Realm, startDate: Date, endDate: Date, net: Double) : Boolean {
			val sessions = realm.where(Session::class.java).equalTo("startDate", startDate).equalTo("endDate", endDate).equalTo("result.net", net).findAll()
			return sessions.isEmpty()
		}

	}

}
