"""Count related attribute container definitions."""

from acstore.containers import interface
from acstore.containers import manager


class DataTypeCount(interface.AttributeContainer):
    """Data type count attribute container.

    Attributes:
      name (str): name of the data type.
      number_of_events (int): number of events generated with this data type.
    """

    CONTAINER_TYPE = "data_type_count"

    SCHEMA = {"name": "str", "number_of_events": "int"}

    def __init__(self, name=None, number_of_events=None):
        """Initializes a data type count attribute container.

        Args:
          name (Optional[str]): name of the data type.
          number_of_events (Optional[int]): number of events generated with this
              data type.
        """
        super().__init__()
        self.name = name
        self.number_of_events = number_of_events


class EventLabelCount(interface.AttributeContainer):
    """Event label count attribute container.

    Attributes:
      label (str): event label.
      number_of_events (int): number of events with label.
    """

    CONTAINER_TYPE = "event_label_count"

    SCHEMA = {"label": "str", "number_of_events": "int"}

    def __init__(self, label=None, number_of_events=None):
        """Initializes an event label count attribute container.

        Args:
          label (Optional[str]): event label.
          number_of_events (Optional[int]): number of events with label.
              the parser or parser plugin.
        """
        super().__init__()
        self.label = label
        self.number_of_events = number_of_events


class ParserCount(interface.AttributeContainer):
    """Parser count attribute container.

    Attributes:
      name (str): name of the parser or parser plugin.
      number_of_events (int): number of events generated by the parser or
          parser plugin.
    """

    CONTAINER_TYPE = "parser_count"

    SCHEMA = {"name": "str", "number_of_events": "int"}

    def __init__(self, name=None, number_of_events=None):
        """Initializes a parser count attribute container.

        Args:
          name (Optional[str]): name of the parser or parser plugin.
          number_of_events (Optional[int]): number of events generated by
              the parser or parser plugin.
        """
        super().__init__()
        self.name = name
        self.number_of_events = number_of_events


class WarningCount(interface.AttributeContainer):
    """Warning count attribute container.

    Attributes:
      number_of_events (int): number of events generated by the parser or
          parser plugin.
    """

    CONTAINER_TYPE = "warning_count"

    SCHEMA = {"number_of_events": "int"}

    def __init__(self, number_of_events=None):
        """Initializes a warning count attribute container.

        Args:
          number_of_events (Optional[int]): number of events generated by
              the parser or parser plugin.
        """
        super().__init__()
        self.number_of_events = number_of_events


manager.AttributeContainersManager.RegisterAttributeContainers(
    [DataTypeCount, EventLabelCount, ParserCount, WarningCount]
)
