import uuid
import datetime as dt
from marshmallow import Schema, fields, post_load, post_dump
from vrpmdvmonitoring import VRPMDV_Monitoring



class VRPMDV_MonitoringSchema(Schema):
        #__envelope__ = {"single": None, "many": "monitorings"}
        id = fields.UUID()
        created_at = fields.DateTime("%m/%d/%Y, %H:%M")
        name = fields.String()
        samplerate = fields.Integer()
        sampleperiod = fields.Integer()
        downtime = fields.Integer()
        owner = fields.String()

        # def get_envelope_key(self, many):
        #     """Helper to get the envelope key."""
        #     key = self.__envelope__["many"] if many else self.__envelope__["single"]
        #     assert key is not None, "Envelope key undefined"
        #     return key
        
        # @post_dump(pass_many=True)
        # def wrap_with_envelope(self, data, many, **kwargs):           
        #     key = self.get_envelope_key(many)
        #     return {key: data}              

        @post_load
        def make_vrpmdv_Monitoring(self, data, **kwargs):
            return VRPMDV_Monitoring(**data)
    


