# Copyright (c) 2017, InfluxFramework LLC
# License: MIT. See LICENSE

import influxframework
from influxframework.model.document import Document


class PrintStyle(Document):
	def validate(self):
		if (
			self.standard == 1
			and not influxframework.local.conf.get("developer_mode")
			and not (influxframework.flags.in_import or influxframework.flags.in_test)
		):

			influxframework.throw(influxframework._("Standard Print Style cannot be changed. Please duplicate to edit."))

	def on_update(self):
		self.export_doc()

	def export_doc(self):
		# export
		from influxframework.modules.utils import export_module_json

		export_module_json(self, self.standard == 1, "Printing")
