from ..Internal.Core import Core
from ..Internal.CommandsGroup import CommandsGroup
from ..Internal import Conversions


# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class Calibration:
	"""Calibration commands group definition. 40 total commands, 12 Sub-groups, 2 group commands"""

	def __init__(self, core: Core, parent):
		self._core = core
		self._base = CommandsGroup("calibration", core, parent)

	@property
	def all(self):
		"""all commands group. 1 Sub-classes, 0 commands."""
		if not hasattr(self, '_all'):
			from .Calibration_.All import All
			self._all = All(self._core, self._base)
		return self._all

	@property
	def csynthesis(self):
		"""csynthesis commands group. 0 Sub-classes, 1 commands."""
		if not hasattr(self, '_csynthesis'):
			from .Calibration_.Csynthesis import Csynthesis
			self._csynthesis = Csynthesis(self._core, self._base)
		return self._csynthesis

	@property
	def data(self):
		"""data commands group. 3 Sub-classes, 0 commands."""
		if not hasattr(self, '_data'):
			from .Calibration_.Data import Data
			self._data = Data(self._core, self._base)
		return self._data

	@property
	def detector(self):
		"""detector commands group. 1 Sub-classes, 0 commands."""
		if not hasattr(self, '_detector'):
			from .Calibration_.Detector import Detector
			self._detector = Detector(self._core, self._base)
		return self._detector

	@property
	def fmOffset(self):
		"""fmOffset commands group. 0 Sub-classes, 1 commands."""
		if not hasattr(self, '_fmOffset'):
			from .Calibration_.FmOffset import FmOffset
			self._fmOffset = FmOffset(self._core, self._base)
		return self._fmOffset

	@property
	def frequency(self):
		"""frequency commands group. 0 Sub-classes, 2 commands."""
		if not hasattr(self, '_frequency'):
			from .Calibration_.Frequency import Frequency
			self._frequency = Frequency(self._core, self._base)
		return self._frequency

	@property
	def level(self):
		"""level commands group. 8 Sub-classes, 2 commands."""
		if not hasattr(self, '_level'):
			from .Calibration_.Level import Level
			self._level = Level(self._core, self._base)
		return self._level

	@property
	def lfOutput(self):
		"""lfOutput commands group. 0 Sub-classes, 1 commands."""
		if not hasattr(self, '_lfOutput'):
			from .Calibration_.LfOutput import LfOutput
			self._lfOutput = LfOutput(self._core, self._base)
		return self._lfOutput

	@property
	def mode(self):
		"""mode commands group. 0 Sub-classes, 2 commands."""
		if not hasattr(self, '_mode'):
			from .Calibration_.Mode import Mode
			self._mode = Mode(self._core, self._base)
		return self._mode

	@property
	def roscillator(self):
		"""roscillator commands group. 2 Sub-classes, 0 commands."""
		if not hasattr(self, '_roscillator'):
			from .Calibration_.Roscillator import Roscillator
			self._roscillator = Roscillator(self._core, self._base)
		return self._roscillator

	@property
	def selected(self):
		"""selected commands group. 1 Sub-classes, 0 commands."""
		if not hasattr(self, '_selected'):
			from .Calibration_.Selected import Selected
			self._selected = Selected(self._core, self._base)
		return self._selected

	@property
	def tselected(self):
		"""tselected commands group. 0 Sub-classes, 3 commands."""
		if not hasattr(self, '_tselected'):
			from .Calibration_.Tselected import Tselected
			self._tselected = Tselected(self._core, self._base)
		return self._tselected

	def get_continue_on_error(self) -> bool:
		"""SCPI: CALibration<HW>:CONTinueonerror \n
		Snippet: value: bool = driver.calibration.get_continue_on_error() \n
		Continues the calibration even though an error was detected. By default adjustments are aborted on error. \n
			:return: state: 0| 1| OFF| ON
		"""
		response = self._core.io.query_str('CALibration<HwInstance>:CONTinueonerror?')
		return Conversions.str_to_bool(response)

	def set_continue_on_error(self, state: bool) -> None:
		"""SCPI: CALibration<HW>:CONTinueonerror \n
		Snippet: driver.calibration.set_continue_on_error(state = False) \n
		Continues the calibration even though an error was detected. By default adjustments are aborted on error. \n
			:param state: 0| 1| OFF| ON
		"""
		param = Conversions.bool_to_str(state)
		self._core.io.write(f'CALibration<HwInstance>:CONTinueonerror {param}')

	def set_debug(self, state: bool) -> None:
		"""SCPI: CALibration<HW>:DEBug \n
		Snippet: driver.calibration.set_debug(state = False) \n
		No command help available \n
			:param state: No help available
		"""
		param = Conversions.bool_to_str(state)
		self._core.io.write(f'CALibration<HwInstance>:DEBug {param}')

	def clone(self) -> 'Calibration':
		"""Clones the group by creating new object from it and its whole existing sub-groups
		Also copies all the existing default Repeated Capabilities setting,
		which you can change independently without affecting the original group"""
		new_group = Calibration(self._core, self._base.parent)
		self._base.synchronize_repcaps(new_group)
		return new_group
