# This file was generated by mettle.genes.db.GenPy3 [ver 2.1] on Mon Feb 15 23:21:02 2021
#

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

class oMsgReqPendingChanged(mettle.io.ISerializable):

    def __init__(self,
                 msg_req_id: int = 0,
                 msg_status: str = '',
                 msg_time: datetime.datetime = datetime.datetime.min):
        """
        Constructor.

        :param msg_req_id: int
        :param msg_status: str
        :param msg_time: datetime.datetime
        """
        self.msg_req_id = msg_req_id
        self.msg_status = msg_status
        self.msg_time = msg_time

    def clear(self):
        """
        Clears all member variables for this database record.
        """
        self.msg_req_id = 0
        self.msg_status = ''
        self.msg_time = datetime.datetime.min

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

        :return: The name.
        """
        return 'oMsgReqPendingChanged'

    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_int64("msg_req_id", self.msg_req_id)
        _w.write_char("msg_status", self.msg_status)
        _w.write_datetime("msg_time", self.msg_time)
        _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.msg_req_id = _r.read_int64("msg_req_id")
        self.msg_status = _r.read_char("msg_status")
        self.msg_time = _r.read_datetime("msg_time")
        _r.read_end(_oname)

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

        :param rec: The source record.
        """
        self.msg_req_id = rec.msg_req_id
        self.msg_status = rec.msg_status
        self.msg_time = rec.msg_time

    def __repr__(self) -> str:
        return '<MsgReq [msg_req_id:%r, msg_status:%.32s, msg_time:%s]>' % (
            self.msg_req_id, self.msg_status, self.msg_time)


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

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

            :return: The name
            """
            return 'oMsgReqPendingChanged.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  = oMsgReqPendingChanged()
                _cnt -= 1
                _rec._deserialize(_r)
                self.append(_rec)

            _r.read_end(_oname)

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

