# Path: cdrouter/cdr_datetime.py
# class DateTime(fields.DateTime):
#     def __init__(self, format=None, **kwargs):
#         super(DateTime, self).__init__(format=format, **kwargs)
#         
#     def _serialize(self, value, attr, obj):
#         try:
#             return super(DateTime, self)._serialize(value, attr, obj)
#         except ValidationError:
#             return datetime.min
# 
#     def _deserialize(self, value, attr, data):
#         try:
#             return super(DateTime, self)._deserialize(value, attr, data)
#         except ValidationError:
#             return datetime.min
# 
# Path: cdrouter/cdr_dictfield.py
# class DictField(fields.Field):
#     def __init__(self, key_field, nested_field, *args, **kwargs):
#         super(DictField, self).__init__(self, *args, **kwargs)
#         self.key_field = key_field
#         self.nested_field = nested_field
# 
#     def _deserialize(self, value, attr, data):
#         if not isinstance(value, collections.Mapping):
#             self.fail('invalid')
# 
#         ret = {}
#         for key, val in value.items():
#             k = self.key_field._deserialize(key, attr, data)
#             data, errors = self.nested_field.load(val)
#             if errors:
#                 raise ValidationError(errors, data=data)
#             v = data
#             ret[k] = v
# 
#         return ret
# 
#     def _serialize(self, value, attr, obj):
#         ret = {}
#         for key, val in value.items():
#             k = self.key_field._serialize(key, attr, obj)
#             data, errors = self.nested_field.dump(val)
#             if errors:
#                 raise ValidationError(errors, data=data)
#             v = data
#             ret[k] = v
#         return ret


import collections
from functools import partial
from marshmallow import Schema, fields, post_load
from .cdr_datetime import DateTime
from .cdr_dictfield import DictField
        self.created = kwargs.get('created', None)
        self.updated = kwargs.get('updated', None)

        self.seq = kwargs.get('seq', None)
        self.loop = kwargs.get('loop', None)
        self.test_name = kwargs.get('test_name', None)
        self.test_description = kwargs.get('test_description', None)

        self.category = kwargs.get('category', None)
        self.description = kwargs.get('description', None)
        self.dest_ip = kwargs.get('dest_ip', None)
        self.dest_port = kwargs.get('dest_port', None)
        self.interface = kwargs.get('interface', None)
        self.payload = kwargs.get('payload', None)
        self.payload_ascii = kwargs.get('payload_ascii', None)
        self.payload_hex = kwargs.get('payload_hex', None)
        self.proto = kwargs.get('proto', None)
        self.references = kwargs.get('references', None)
        self.rev = kwargs.get('rev', None)
        self.rule = kwargs.get('rule', None)
        self.rule_set = kwargs.get('rule_set', None)
        self.severity = kwargs.get('severity', None)
        self.sid = kwargs.get('sid', None)
        self.signature = kwargs.get('signature', None)
        self.src_ip = kwargs.get('src_ip', None)
        self.src_port = kwargs.get('src_port', None)

class AlertSchema(Schema):
    id = fields.Int(as_string=True)
    idx = fields.Int(as_string=True)

# Path: cdrouter/cdr_datetime.py
# class DateTime(fields.DateTime):
#     def __init__(self, format=None, **kwargs):
#         super(DateTime, self).__init__(format=format, **kwargs)
#         
#     def _serialize(self, value, attr, obj):
#         try:
#             return super(DateTime, self)._serialize(value, attr, obj)
#         except ValidationError:
#             return datetime.min
# 
#     def _deserialize(self, value, attr, data):
#         try:
#             return super(DateTime, self)._deserialize(value, attr, data)
#         except ValidationError:
#             return datetime.min
# 
# Path: cdrouter/cdr_dictfield.py
# class DictField(fields.Field):
#     def __init__(self, key_field, nested_field, *args, **kwargs):
#         super(DictField, self).__init__(self, *args, **kwargs)
#         self.key_field = key_field
#         self.nested_field = nested_field
# 
#     def _deserialize(self, value, attr, data):
#         if not isinstance(value, collections.Mapping):
#             self.fail('invalid')
# 
#         ret = {}
#         for key, val in value.items():
#             k = self.key_field._deserialize(key, attr, data)
#             data, errors = self.nested_field.load(val)
#             if errors:
#                 raise ValidationError(errors, data=data)
#             v = data
#             ret[k] = v
# 
#         return ret
# 
#     def _serialize(self, value, attr, obj):
#         ret = {}
#         for key, val in value.items():
#             k = self.key_field._serialize(key, attr, obj)
#             data, errors = self.nested_field.dump(val)
#             if errors:
#                 raise ValidationError(errors, data=data)
#             v = data
#             ret[k] = v
#         return ret


# Path: cdrouter/alerts.py
import collections
from functools import partial
from marshmallow import Schema, fields, post_load
from .cdr_datetime import DateTime
from .cdr_dictfield import DictField

        self.created = kwargs.get('created', None)
        self.updated = kwargs.get('updated', None)

        self.seq = kwargs.get('seq', None)
        self.loop = kwargs.get('loop', None)
        self.test_name = kwargs.get('test_name', None)
        self.test_description = kwargs.get('test_description', None)

        self.category = kwargs.get('category', None)
        self.description = kwargs.get('description', None)
        self.dest_ip = kwargs.get('dest_ip', None)
        self.dest_port = kwargs.get('dest_port', None)
        self.interface = kwargs.get('interface', None)
        self.payload = kwargs.get('payload', None)
        self.payload_ascii = kwargs.get('payload_ascii', None)
        self.payload_hex = kwargs.get('payload_hex', None)
        self.proto = kwargs.get('proto', None)
        self.references = kwargs.get('references', None)
        self.rev = kwargs.get('rev', None)
        self.rule = kwargs.get('rule', None)
        self.rule_set = kwargs.get('rule_set', None)
        self.severity = kwargs.get('severity', None)
        self.sid = kwargs.get('sid', None)
        self.signature = kwargs.get('signature', None)
        self.src_ip = kwargs.get('src_ip', None)
        self.src_port = kwargs.get('src_port', None)

class AlertSchema(Schema):
    id = fields.Int(as_string=True)
    idx = fields.Int(as_string=True)

    created = DateTime()