from __future__ import annotations
from vanirio.module.interface.base import Base


class Number(Base):
    def __init__(self, tag: str, label: str):
        """
        A Number interface object is used as a parameter for module software. The interface
        can be used for either integers as float value numbers.

        :param label: GUI label name
        :param tag: Module tag name
        """
        super().__init__()
        self.label = label
        self.tag = tag
        self._type = 'NUMBER'
        self._decimals = 0
        self._step = 1
        self._min = -999999999
        self._max = -self._min

    def encode(self) -> dict:
        _base = self.encode_base()
        _base.update({
            'decimal': self._decimals,
            'step': self._step,
            'min': self._min,
            'max': self._max
        })
        return _base
