import uuid
import datetime as dt
from marshmallow import Schema, fields, post_load, EXCLUDE
from utilities.union import UnionField
from vrpmdvmonfilescomplete import VRPMDV_MonfilesComplete
from vrpmdvmonfilesschema import VRPMDV_MonfilesSchema




# books = fields.List(fields.Nested("BookSchema", exclude=("author",)))

class VRPMDV_MonfilesCompleteSchema(Schema): 
        id =  fields.String(required=True)
        monid =  fields.String(required=True) 
        name = fields.String(required=True)
        samplerate = fields.Integer(required=True)
        sampleperiod = fields.Integer(required=True)
        downtime = fields.Integer(required=True)
        timestamp = fields.Integer(required=True)
        hwdescription = fields.List(fields.Nested("VRPMDV_MonSensorSchema"))          
        values = fields.List(UnionField(
            types=[int, float],
            metadata={
                "description": "Multiple types.",
            },
        ))

        @post_load
        def make_vrpmdv_MonfilesCompleteSchema(self, data, **kwargs):
            return VRPMDV_MonfilesComplete(**data)


    # some_field = UnionField(
    #     types=[str, int, float, dict, list, bool, set, tuple],
    #     metadata={
    #         "description": "Multiple types.",
    #     },
    # )