from typing import List

from ......Internal.Core import Core
from ......Internal.CommandsGroup import CommandsGroup
from ......Internal import Conversions
from ......Internal.Types import DataType
from ......Internal.Utilities import trim_str_response
from ......Internal.StructBase import StructBase
from ......Internal.ArgStruct import ArgStruct
from ...... import enums


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

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

	# noinspection PyTypeChecker
	class DpatternStruct(StructBase):
		"""Structure for reading output parameters. Fields: \n
			- Dpattern: List[str]: numeric
			- Bitcount: int: integer Range: 1 to 64"""
		__meta_args_list = [
			ArgStruct('Dpattern', DataType.RawStringList, None, False, True, 1),
			ArgStruct.scalar_int('Bitcount')]

		def __init__(self):
			StructBase.__init__(self, self)
			self.Dpattern: List[str] = None
			self.Bitcount: int = None

	def get_dpattern(self) -> DpatternStruct:
		"""SCPI: [SOURce<HW>]:BB:BTOoth:PCONfiguration:DATA:DPATtern \n
		Snippet: value: DpatternStruct = driver.source.bb.btooth.pconfiguration.data.get_dpattern() \n
		Selects the data for a pattern. \n
			:return: structure: for return value, see the help for DpatternStruct structure arguments.
		"""
		return self._core.io.query_struct('SOURce<HwInstance>:BB:BTOoth:PCONfiguration:DATA:DPATtern?', self.__class__.DpatternStruct())

	def set_dpattern(self, value: DpatternStruct) -> None:
		"""SCPI: [SOURce<HW>]:BB:BTOoth:PCONfiguration:DATA:DPATtern \n
		Snippet: driver.source.bb.btooth.pconfiguration.data.set_dpattern(value = DpatternStruct()) \n
		Selects the data for a pattern. \n
			:param value: see the help for DpatternStruct structure arguments.
		"""
		self._core.io.write_struct('SOURce<HwInstance>:BB:BTOoth:PCONfiguration:DATA:DPATtern', value)

	def get_dselection(self) -> str:
		"""SCPI: [SOURce<HW>]:BB:BTOoth:PCONfiguration:DATA:DSELection \n
		Snippet: value: str = driver.source.bb.btooth.pconfiguration.data.get_dselection() \n
		The command selects data list file. \n
			:return: dselection: string
		"""
		response = self._core.io.query_str('SOURce<HwInstance>:BB:BTOoth:PCONfiguration:DATA:DSELection?')
		return trim_str_response(response)

	def set_dselection(self, dselection: str) -> None:
		"""SCPI: [SOURce<HW>]:BB:BTOoth:PCONfiguration:DATA:DSELection \n
		Snippet: driver.source.bb.btooth.pconfiguration.data.set_dselection(dselection = '1') \n
		The command selects data list file. \n
			:param dselection: string
		"""
		param = Conversions.value_to_quoted_str(dselection)
		self._core.io.write(f'SOURce<HwInstance>:BB:BTOoth:PCONfiguration:DATA:DSELection {param}')

	# noinspection PyTypeChecker
	class VdPatternStruct(StructBase):
		"""Structure for reading output parameters. Fields: \n
			- Vd_Pattern: List[str]: numeric
			- Bitcount: int: integer Range: 1 to 64"""
		__meta_args_list = [
			ArgStruct('Vd_Pattern', DataType.RawStringList, None, False, True, 1),
			ArgStruct.scalar_int('Bitcount')]

		def __init__(self):
			StructBase.__init__(self, self)
			self.Vd_Pattern: List[str] = None
			self.Bitcount: int = None

	def get_vd_pattern(self) -> VdPatternStruct:
		"""SCPI: [SOURce<HW>]:BB:BTOoth:PCONfiguration:DATA:VDPAttern \n
		Snippet: value: VdPatternStruct = driver.source.bb.btooth.pconfiguration.data.get_vd_pattern() \n
		Sets the bit pattern for the voice data. \n
			:return: structure: for return value, see the help for VdPatternStruct structure arguments.
		"""
		return self._core.io.query_struct('SOURce<HwInstance>:BB:BTOoth:PCONfiguration:DATA:VDPAttern?', self.__class__.VdPatternStruct())

	def set_vd_pattern(self, value: VdPatternStruct) -> None:
		"""SCPI: [SOURce<HW>]:BB:BTOoth:PCONfiguration:DATA:VDPAttern \n
		Snippet: driver.source.bb.btooth.pconfiguration.data.set_vd_pattern(value = VdPatternStruct()) \n
		Sets the bit pattern for the voice data. \n
			:param value: see the help for VdPatternStruct structure arguments.
		"""
		self._core.io.write_struct('SOURce<HwInstance>:BB:BTOoth:PCONfiguration:DATA:VDPAttern', value)

	def get_vd_selection(self) -> str:
		"""SCPI: [SOURce<HW>]:BB:BTOoth:PCONfiguration:DATA:VDSElection \n
		Snippet: value: str = driver.source.bb.btooth.pconfiguration.data.get_vd_selection() \n
		Selects the data list for voice data. \n
			:return: vd_selection: string
		"""
		response = self._core.io.query_str('SOURce<HwInstance>:BB:BTOoth:PCONfiguration:DATA:VDSElection?')
		return trim_str_response(response)

	def set_vd_selection(self, vd_selection: str) -> None:
		"""SCPI: [SOURce<HW>]:BB:BTOoth:PCONfiguration:DATA:VDSElection \n
		Snippet: driver.source.bb.btooth.pconfiguration.data.set_vd_selection(vd_selection = '1') \n
		Selects the data list for voice data. \n
			:param vd_selection: string
		"""
		param = Conversions.value_to_quoted_str(vd_selection)
		self._core.io.write(f'SOURce<HwInstance>:BB:BTOoth:PCONfiguration:DATA:VDSElection {param}')

	# noinspection PyTypeChecker
	def get_value(self) -> enums.DataSourceB:
		"""SCPI: [SOURce<HW>]:BB:BTOoth:PCONfiguration:DATA \n
		Snippet: value: enums.DataSourceB = driver.source.bb.btooth.pconfiguration.data.get_value() \n
		Selects the data source used for the payload. \n
			:return: data: ALL0| ALL1| PATTern| PN09| PN11| PN15| PN16| PN20| PN21| PN23| DLISt
		"""
		response = self._core.io.query_str('SOURce<HwInstance>:BB:BTOoth:PCONfiguration:DATA?')
		return Conversions.str_to_scalar_enum(response, enums.DataSourceB)

	def set_value(self, data: enums.DataSourceB) -> None:
		"""SCPI: [SOURce<HW>]:BB:BTOoth:PCONfiguration:DATA \n
		Snippet: driver.source.bb.btooth.pconfiguration.data.set_value(data = enums.DataSourceB.ALL0) \n
		Selects the data source used for the payload. \n
			:param data: ALL0| ALL1| PATTern| PN09| PN11| PN15| PN16| PN20| PN21| PN23| DLISt
		"""
		param = Conversions.enum_scalar_to_str(data, enums.DataSourceB)
		self._core.io.write(f'SOURce<HwInstance>:BB:BTOoth:PCONfiguration:DATA {param}')
