# This file was generated by mettle.genes.db.GenPy3 [ver 2.1] on Tue Mar 30 15:41:12 2021
#

import copy
import datetime
import uuid
import time
import mettle.lib
import mettle.io
import mettle.db

class oMsgStatusCntByReq(mettle.io.ISerializable):

    def __init__(self,
                 status: str = '',
                 cnt: int = 0):
        """
        Constructor.

        :param status: str
        :param cnt: int
        """
        self.status = status
        self.cnt = cnt

    def clear(self):
        """
        Clears all member variables for this database record.
        """
        self.status = ''
        self.cnt = 0

    def _name(self) -> str:
        """
        Name of the record.

        :return: The name.
        """
        return 'oMsgStatusCntByReq'

    def _serialize(self, _w: mettle.io.IWriter, _oname: str = None):
        """
        Serialize record to a stream.

        :param _w:
        :param _oname:
        """
        if _oname == None:
            _oname = self._name()

        _w.write_start(_oname)
        _w.write_char("status", self.status)
        _w.write_int32("cnt", self.cnt)
        _w.write_end(_oname)

    def _deserialize(self, _r: mettle.io.IReader, _oname: str = None):
        """
        Deserialize record from a stream.

        :param _r:
        :param _oname:
        """
        if _oname == None:
            _oname = self._name()

        _r.read_start(_oname)
        self.status = _r.read_char("status")
        self.cnt = _r.read_int32("cnt")
        _r.read_end(_oname)

    def _copy_from(self, rec: "oMsgStatusCntByReq"):
        """
        Copies the column from the rec into this record.

        :param rec: The source record.
        """
        self.status = rec.status
        self.cnt = rec.cnt

    def __repr__(self) -> str:
        return '<Msg [status:%.32s, cnt:%r]>' % (
            self.status, self.cnt)


    class List(list, mettle.io.ISerializable):
        """
        List Class
        """

        def _name(self) -> str:
            """
            Name of the list.

            :return: The name
            """
            return 'oMsgStatusCntByReq.List'

        def _serialize(self, _w: mettle.io.IWriter, _oname: str = None):
            """
            Serialize the list to a stream.

            :param _w:
            :param _oname:
            """
            if _oname == None:
                _oname = self._name()

            _w.write_start_list(_oname, len(self))

            for _rec in self:
                _rec._serialize(_w)

            _w.write_end(_oname)

        def _deserialize(self, _r: mettle.io.IReader, _oname: str = None):
            """
            Deserialize the list from a stream.

            :param _r:
            :param _oname:
            """
            if _oname == None:
                _oname = self._name()

            _cnt = _r.read_start_list(_oname)

            while _cnt >= 1:
                _rec  = oMsgStatusCntByReq()
                _cnt -= 1
                _rec._deserialize(_r)
                self.append(_rec)

            _r.read_end(_oname)

        def __repr__(self) -> str:
            return '<oMsgStatusCntByReq.List[%d]>' % (len(self))

