package ru.dbotthepony.mc.otm.capability.matter

private enum class PatternInsertResult {
	FAIL,
	UPDATED,
	INSERTED;
}

sealed class PatternInsertStatus(
	private val status: PatternInsertResult,
	val newState: PatternState?,
	val oldState: PatternState?
) {
	val isFailed get() = status == PatternInsertResult.FAIL
	val isUpdated get() = status == PatternInsertResult.UPDATED
	val isInserted get() = status == PatternInsertResult.INSERTED
}

object PatternInsertFailure : PatternInsertStatus(PatternInsertResult.FAIL, null, null)
class PatternInsertUpdated(new: PatternState, old: PatternState) : PatternInsertStatus(PatternInsertResult.UPDATED, new, old)
class PatternInsertInserted(new: PatternState) : PatternInsertStatus(PatternInsertResult.INSERTED, new, null)

@JvmRecord
data class ReplicationTaskAllocation(val task: ReplicationTask, val pattern: PatternState?)
