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


# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class Slevel:
	"""Slevel commands group definition. 1 total commands, 0 Sub-groups, 1 group commands"""

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

	def set(self, slevel: enums.TetraSlotLevel, testMode=repcap.TestMode.Default, slot=repcap.Slot.Default, channel=repcap.Channel.Default) -> None:
		"""SCPI: [SOURce<HW>]:BB:TETRa:SCONfiguration:TMODe<DI>:SLOT<ST>:LDIRection<CH>:SLEVel \n
		Snippet: driver.source.bb.tetra.sconfiguration.tmode.slot.ldirection.slevel.set(slevel = enums.TetraSlotLevel.ATTenuated, testMode = repcap.TestMode.Default, slot = repcap.Slot.Default, channel = repcap.Channel.Default) \n
		Sets the level for the selected slot. \n
			:param slevel: OFF| ATTenuated| FULL OFF Attenuation is maximum. The slot is inactive. ATT Level is reduced by the level attenuation set in 'Slot Attenuation'. FULL The level corresponds to the level indicated in the display.
			:param testMode: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Tmode')
			:param slot: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Slot')
			:param channel: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Ldirection')"""
		param = Conversions.enum_scalar_to_str(slevel, enums.TetraSlotLevel)
		testMode_cmd_val = self._base.get_repcap_cmd_value(testMode, repcap.TestMode)
		slot_cmd_val = self._base.get_repcap_cmd_value(slot, repcap.Slot)
		channel_cmd_val = self._base.get_repcap_cmd_value(channel, repcap.Channel)
		self._core.io.write(f'SOURce<HwInstance>:BB:TETRa:SCONfiguration:TMODe{testMode_cmd_val}:SLOT{slot_cmd_val}:LDIRection{channel_cmd_val}:SLEVel {param}')

	# noinspection PyTypeChecker
	def get(self, testMode=repcap.TestMode.Default, slot=repcap.Slot.Default, channel=repcap.Channel.Default) -> enums.TetraSlotLevel:
		"""SCPI: [SOURce<HW>]:BB:TETRa:SCONfiguration:TMODe<DI>:SLOT<ST>:LDIRection<CH>:SLEVel \n
		Snippet: value: enums.TetraSlotLevel = driver.source.bb.tetra.sconfiguration.tmode.slot.ldirection.slevel.get(testMode = repcap.TestMode.Default, slot = repcap.Slot.Default, channel = repcap.Channel.Default) \n
		Sets the level for the selected slot. \n
			:param testMode: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Tmode')
			:param slot: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Slot')
			:param channel: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Ldirection')
			:return: slevel: OFF| ATTenuated| FULL OFF Attenuation is maximum. The slot is inactive. ATT Level is reduced by the level attenuation set in 'Slot Attenuation'. FULL The level corresponds to the level indicated in the display."""
		testMode_cmd_val = self._base.get_repcap_cmd_value(testMode, repcap.TestMode)
		slot_cmd_val = self._base.get_repcap_cmd_value(slot, repcap.Slot)
		channel_cmd_val = self._base.get_repcap_cmd_value(channel, repcap.Channel)
		response = self._core.io.query_str(f'SOURce<HwInstance>:BB:TETRa:SCONfiguration:TMODe{testMode_cmd_val}:SLOT{slot_cmd_val}:LDIRection{channel_cmd_val}:SLEVel?')
		return Conversions.str_to_scalar_enum(response, enums.TetraSlotLevel)
