# -*- coding: utf-8 -*-
# This file is auto-generated, don't edit it. Thanks.
from __future__ import annotations

from typing import List

from alibabacloud_adb20190315 import models as main_models
from darabonba.model import DaraModel

class DescribeHistoryEventsStatResponseBody(DaraModel):
    def __init__(
        self,
        items: List[main_models.DescribeHistoryEventsStatResponseBodyItems] = None,
        request_id: str = None,
    ):
        # The queried events.
        self.items = items
        # The request ID.
        self.request_id = request_id

    def validate(self):
        if self.items:
            for v1 in self.items:
                 if v1:
                    v1.validate()

    def to_map(self):
        result = dict()
        _map = super().to_map()
        if _map is not None:
            result = _map
        result['Items'] = []
        if self.items is not None:
            for k1 in self.items:
                result['Items'].append(k1.to_map() if k1 else None)

        if self.request_id is not None:
            result['RequestId'] = self.request_id

        return result

    def from_map(self, m: dict = None):
        m = m or dict()
        self.items = []
        if m.get('Items') is not None:
            for k1 in m.get('Items'):
                temp_model = main_models.DescribeHistoryEventsStatResponseBodyItems()
                self.items.append(temp_model.from_map(k1))

        if m.get('RequestId') is not None:
            self.request_id = m.get('RequestId')

        return self

class DescribeHistoryEventsStatResponseBodyItems(DaraModel):
    def __init__(
        self,
        event_category: str = None,
        total_count: int = None,
    ):
        # The system event category. Valid values:
        # 
        # *   Exception
        # *   Optimize
        # *   Notification
        # *   Maintenance
        self.event_category = event_category
        # The total number of entries returned.
        self.total_count = total_count

    def validate(self):
        pass

    def to_map(self):
        result = dict()
        _map = super().to_map()
        if _map is not None:
            result = _map
        if self.event_category is not None:
            result['EventCategory'] = self.event_category

        if self.total_count is not None:
            result['TotalCount'] = self.total_count

        return result

    def from_map(self, m: dict = None):
        m = m or dict()
        if m.get('EventCategory') is not None:
            self.event_category = m.get('EventCategory')

        if m.get('TotalCount') is not None:
            self.total_count = m.get('TotalCount')

        return self

