--[=[
	Returns whether the subscription is pending.
	@return boolean
]=]

function Subscription:IsPending()
	return self._state == stateTypes.PENDING
end

function Subscription:_giveCleanup(task)
	assert(task, "Bad task")
	assert(not self._cleanupTask, "Already have _cleanupTask")

	if self._state ~= stateTypes.PENDING then
		MaidTaskUtils.doTask(task)
		return
	end

	self._cleanupTask = task
end

function Subscription:_doCleanup()
	if self._cleanupTask then
		local task = self._cleanupTask
		self._cleanupTask = nil
		MaidTaskUtils.doTask(task)
	end
end
