from parallels.common.actions.base.base_action \
	import BaseAction

class SubscriptionAction(BaseAction):
	"""Base class for actions performed on single subscription

	Action is a single operation in migration process. Subscription action
	could be performed on each subscription independently.

	Examples of actions: copy web content of a subscription, copy mail messages
	of a subscription, restore hosting settings of a subscription.
	"""

	def is_critical(self):
		"""If action is critical or not

		If action is critical and it failed for a subscription, migration tool
		won't run the next operations for the subscription.
		"""
		return True

	def filter_subscription(self, global_context, subscription):
		"""Check if we should run this action on given subscription or not

		The function returns true if it should be executed for the given
		subscription, and false if we should not run the action. For example,
		we should not work with .Security files for Linux subscriptions -
		filter them out in that function.

		Arguments:
		- global_context - registry with different objects that reused among
		  different actions
		- subscription - object with information about single subscription,
		  instance of
		  parallels.common.migrated_subscription.MigrationSubscription
		"""
		raise NotImplementedError()

	def get_failure_message(self, global_context, subscription):
		"""Get message for situation when action failed

		Arguments:
		- global_context - registry with different objects that reused among
		  different actions
		- subscription - object with information about single subscription,
		  instance of
		  parallels.common.migrated_subscription.MigrationSubscription
		"""
		raise NotImplementedError()

	def run(self, global_context, subscription):
		"""Run action on given subscription

		Arguments:
		- global_context - registry with different objects that reused among
		  different actions
		- subscription - object with information about single subscription,
		  instance of
		  parallels.common.migrated_subscription.MigrationSubscription
		"""
		raise NotImplementedError()