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


# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class TriggerCls:
	"""Trigger commands group definition. 18 total commands, 3 Subgroups, 4 group commands"""

	def __init__(self, core: Core, parent):
		self._core = core
		self._cmd_group = CommandsGroup("trigger", core, parent)

	@property
	def external(self):
		"""external commands group. 3 Sub-classes, 0 commands."""
		if not hasattr(self, '_external'):
			from .External import ExternalCls
			self._external = ExternalCls(self._core, self._cmd_group)
		return self._external

	@property
	def obaseband(self):
		"""obaseband commands group. 0 Sub-classes, 2 commands."""
		if not hasattr(self, '_obaseband'):
			from .Obaseband import ObasebandCls
			self._obaseband = ObasebandCls(self._core, self._cmd_group)
		return self._obaseband

	@property
	def output(self):
		"""output commands group. 6 Sub-classes, 0 commands."""
		if not hasattr(self, '_output'):
			from .Output import OutputCls
			self._output = OutputCls(self._core, self._cmd_group)
		return self._output

	def get_slength(self) -> int:
		"""SCPI: [SOURce<HW>]:BB:XMRadio:TERRestrial:TRIGger:SLENgth \n
		Snippet: value: int = driver.source.bb.xmRadio.terrestrial.trigger.get_slength() \n
		No command help available \n
			:return: slength: No help available
		"""
		response = self._core.io.query_str('SOURce<HwInstance>:BB:XMRadio:TERRestrial:TRIGger:SLENgth?')
		return Conversions.str_to_int(response)

	def set_slength(self, slength: int) -> None:
		"""SCPI: [SOURce<HW>]:BB:XMRadio:TERRestrial:TRIGger:SLENgth \n
		Snippet: driver.source.bb.xmRadio.terrestrial.trigger.set_slength(slength = 1) \n
		No command help available \n
			:param slength: No help available
		"""
		param = Conversions.decimal_value_to_str(slength)
		self._core.io.write(f'SOURce<HwInstance>:BB:XMRadio:TERRestrial:TRIGger:SLENgth {param}')

	# noinspection PyTypeChecker
	def get_sl_unit(self) -> enums.UnitSlXmRadio:
		"""SCPI: [SOURce<HW>]:BB:XMRadio:TERRestrial:TRIGger:SLUNit \n
		Snippet: value: enums.UnitSlXmRadio = driver.source.bb.xmRadio.terrestrial.trigger.get_sl_unit() \n
		No command help available \n
			:return: sl_unit: No help available
		"""
		response = self._core.io.query_str('SOURce<HwInstance>:BB:XMRadio:TERRestrial:TRIGger:SLUNit?')
		return Conversions.str_to_scalar_enum(response, enums.UnitSlXmRadio)

	def set_sl_unit(self, sl_unit: enums.UnitSlXmRadio) -> None:
		"""SCPI: [SOURce<HW>]:BB:XMRadio:TERRestrial:TRIGger:SLUNit \n
		Snippet: driver.source.bb.xmRadio.terrestrial.trigger.set_sl_unit(sl_unit = enums.UnitSlXmRadio.MCM) \n
		No command help available \n
			:param sl_unit: No help available
		"""
		param = Conversions.enum_scalar_to_str(sl_unit, enums.UnitSlXmRadio)
		self._core.io.write(f'SOURce<HwInstance>:BB:XMRadio:TERRestrial:TRIGger:SLUNit {param}')

	# noinspection PyTypeChecker
	def get_source(self) -> enums.TriggerSourceB:
		"""SCPI: [SOURce<HW>]:BB:XMRadio:TERRestrial:TRIGger:SOURce \n
		Snippet: value: enums.TriggerSourceB = driver.source.bb.xmRadio.terrestrial.trigger.get_source() \n
		No command help available \n
			:return: source: No help available
		"""
		response = self._core.io.query_str('SOURce<HwInstance>:BB:XMRadio:TERRestrial:TRIGger:SOURce?')
		return Conversions.str_to_scalar_enum(response, enums.TriggerSourceB)

	def set_source(self, source: enums.TriggerSourceB) -> None:
		"""SCPI: [SOURce<HW>]:BB:XMRadio:TERRestrial:TRIGger:SOURce \n
		Snippet: driver.source.bb.xmRadio.terrestrial.trigger.set_source(source = enums.TriggerSourceB.BEXTernal) \n
		No command help available \n
			:param source: No help available
		"""
		param = Conversions.enum_scalar_to_str(source, enums.TriggerSourceB)
		self._core.io.write(f'SOURce<HwInstance>:BB:XMRadio:TERRestrial:TRIGger:SOURce {param}')

	# noinspection PyTypeChecker
	def get_sequence(self) -> enums.DmTrigMode:
		"""SCPI: [SOURce<HW>]:BB:XMRadio:TERRestrial:[TRIGger]:SEQuence \n
		Snippet: value: enums.DmTrigMode = driver.source.bb.xmRadio.terrestrial.trigger.get_sequence() \n
		No command help available \n
			:return: sequence: No help available
		"""
		response = self._core.io.query_str('SOURce<HwInstance>:BB:XMRadio:TERRestrial:TRIGger:SEQuence?')
		return Conversions.str_to_scalar_enum(response, enums.DmTrigMode)

	def set_sequence(self, sequence: enums.DmTrigMode) -> None:
		"""SCPI: [SOURce<HW>]:BB:XMRadio:TERRestrial:[TRIGger]:SEQuence \n
		Snippet: driver.source.bb.xmRadio.terrestrial.trigger.set_sequence(sequence = enums.DmTrigMode.AAUTo) \n
		No command help available \n
			:param sequence: No help available
		"""
		param = Conversions.enum_scalar_to_str(sequence, enums.DmTrigMode)
		self._core.io.write(f'SOURce<HwInstance>:BB:XMRadio:TERRestrial:TRIGger:SEQuence {param}')

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