# -*- coding: utf8 -*-
from __future__ import unicode_literals

import hashlib
from os import path

from eulxml import xmlmap

from wer.helpers import DateField

REPORT_TYPES = (
    (0, 'Non Critical'),
    (1, 'Critical'),
    (2, 'Application Crash'),
    (3, 'Application Hang'),
    (4, 'Kernel Error')
)

FILE_TYPES = (
    (1, 'User Document'),
    (2, 'Other')
)


class DictMixin(object):
    """ Mixin class in order to export :class:`eulxml.xmlmap.XmlObject values to a Python dict"""

    def to_dict(self):
        """
        Recusively exports object values to a dict

        :return: `dict`of values
        """
        if not hasattr(self, '_fields'):
            return self.__dict__
        result = dict()
        for field_name, field in self._fields.items():