# Path: mass_flask_config/app.py
# BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SECRET_FILE = os.path.join(BASE_DIR, 'secret.txt')
# def setup_session_auth(user_loader):
# def setup_key_based_auth(key_loader):
# def unauthorized_callback():
# 
# Path: mass_flask_core/models/sample.py
# class Sample(db.Document, CommentsMixin):
#     delivery_date = DateTimeField(default=TimeFunctions.get_timestamp, required=True)
#     first_seen = DateTimeField(default=TimeFunctions.get_timestamp, required=True)
#     tags = ListField(StringField(regex=r'^[\w:\-\_\/\+\.]+$'))
#     dispatched_to = ListField(ReferenceField(AnalysisSystem))
#     created_by = GenericReferenceField()
#     tlp_level = TLPLevelField(verbose_name='TLP Level', help_text='Privacy level of this sample', required=True)
# 
#     meta = {
#         'allow_inheritance': True,
#         'ordering': ['-delivery_date'],
#         'indexes': ['delivery_date'],
#         'queryset_class': SampleQuerySet
#     }
# 
#     def __repr__(self):
#         return '[{}] {}'.format(str(self.__class__.__name__), str(self.id))
# 
#     def __str__(self):
#         return self.__repr__()
# 
#     @property
#     def title(self):
#         return self.id
# 
#     def add_tags(self, tags):
#         self.tags = ListFunctions.merge_lists_without_duplicates(self.tags, tags)
#         self.save()
# 
#     def _update(self, **kwargs):
#         if 'first_seen' in kwargs and kwargs['first_seen'] < self.first_seen:
#             self.first_seen = kwargs['first_seen']
#         if 'tlp_level' in kwargs and not self.tlp_level:
#             self.tlp_level = kwargs['tlp_level']
#         if current_authenticated_entity.is_authenticated and not self.created_by:
#             self.created_by = current_authenticated_entity._get_current_object()
#         if 'tags' in kwargs:
#             tags = kwargs['tags']
#         else:
#             tags = []
#         self.tags = ListFunctions.merge_lists_without_duplicates(self.tags, tags)
# 
#     @classmethod
#     def create_or_update(cls, **kwargs):
#         raise ValidationError('Samples of the base type Sample should not be instantiated directly.')


from mongoengine import FloatField
from mongoengine import ReferenceField
from mongoengine import ValidationError
from mass_flask_config.app import db
from .sample import Sample
import logging


logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()


class SampleRelation(db.Document):

# Path: mass_flask_config/app.py
# BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# SECRET_FILE = os.path.join(BASE_DIR, 'secret.txt')
# def setup_session_auth(user_loader):
# def setup_key_based_auth(key_loader):
# def unauthorized_callback():
# 
# Path: mass_flask_core/models/sample.py
# class Sample(db.Document, CommentsMixin):
#     delivery_date = DateTimeField(default=TimeFunctions.get_timestamp, required=True)
#     first_seen = DateTimeField(default=TimeFunctions.get_timestamp, required=True)
#     tags = ListField(StringField(regex=r'^[\w:\-\_\/\+\.]+$'))
#     dispatched_to = ListField(ReferenceField(AnalysisSystem))
#     created_by = GenericReferenceField()
#     tlp_level = TLPLevelField(verbose_name='TLP Level', help_text='Privacy level of this sample', required=True)
# 
#     meta = {
#         'allow_inheritance': True,
#         'ordering': ['-delivery_date'],
#         'indexes': ['delivery_date'],
#         'queryset_class': SampleQuerySet
#     }
# 
#     def __repr__(self):
#         return '[{}] {}'.format(str(self.__class__.__name__), str(self.id))
# 
#     def __str__(self):
#         return self.__repr__()
# 
#     @property
#     def title(self):
#         return self.id
# 
#     def add_tags(self, tags):
#         self.tags = ListFunctions.merge_lists_without_duplicates(self.tags, tags)
#         self.save()
# 
#     def _update(self, **kwargs):
#         if 'first_seen' in kwargs and kwargs['first_seen'] < self.first_seen:
#             self.first_seen = kwargs['first_seen']
#         if 'tlp_level' in kwargs and not self.tlp_level:
#             self.tlp_level = kwargs['tlp_level']
#         if current_authenticated_entity.is_authenticated and not self.created_by:
#             self.created_by = current_authenticated_entity._get_current_object()
#         if 'tags' in kwargs:
#             tags = kwargs['tags']
#         else:
#             tags = []
#         self.tags = ListFunctions.merge_lists_without_duplicates(self.tags, tags)
# 
#     @classmethod
#     def create_or_update(cls, **kwargs):
#         raise ValidationError('Samples of the base type Sample should not be instantiated directly.')


# Path: mass_flask_core/models/sample_relation.py
from mongoengine import FloatField
from mongoengine import ReferenceField
from mongoengine import ValidationError
from mass_flask_config.app import db
from .sample import Sample
import logging



logging.basicConfig(level=logging.INFO)
logger = logging.getLogger()


class SampleRelation(db.Document):

    sample = ReferenceField(Sample, required=True)