# Path: models/user.py
# class User(Document, UserMixin):
#     username = StringField(max_length=200)
#     password = StringField(max_length=200, default='')
#     name = StringField(max_length=100)
#     email = EmailField()
#     active = BooleanField(default=True)
#     admin = BooleanField(default=False)
#     last_login = DateTimeField(default=datetime.datetime.now)
#     skipped = IntField(default=0)
#     processed = IntField(default=0)
#     tags = ListField(StringField(), default=[])
#     tags_count = IntField(default=0, db_field='tagsCount')
# 
#     def is_active(self):
#         return self.active
# 
#     def is_admin(self):
#         return self.admin or False
# 
#     def __unicode__(self):
#         return self.username


from collections import Counter
from mongoengine import (
    StringField, IntField, DateTimeField, ListField, BooleanField,
    ReferenceField, EmbeddedDocument, EmbeddedDocumentField, FloatField,
    CASCADE, QuerySet)
from flask_mongoengine import Document
from .user import User
import datetime
import random
import jinja2





class Features(EmbeddedDocument):
    histogram_clean = ListField(IntField())
    height_mm = FloatField(required=True)
    histogram_full = ListField(IntField())
    width_mm = FloatField(required=True)
    area = IntField(required=True)
    dominant_colours = ListField(StringField())
    solidity = FloatField(required=True)
    colour_names = ListField(StringField())
    ratio = FloatField(required=True)
    width = IntField(required=True)
    height = IntField(required=True)


class ShredTags(EmbeddedDocument):
    user = ReferenceField(User)
    tags = ListField(StringField())
    recognizable_chars = StringField()
    angle = IntField(default=0)
    pages = ListField(ReferenceField("Pages"))


# Immutable once imported from CV.

# Path: models/user.py
# class User(Document, UserMixin):
#     username = StringField(max_length=200)
#     password = StringField(max_length=200, default='')
#     name = StringField(max_length=100)
#     email = EmailField()
#     active = BooleanField(default=True)
#     admin = BooleanField(default=False)
#     last_login = DateTimeField(default=datetime.datetime.now)
#     skipped = IntField(default=0)
#     processed = IntField(default=0)
#     tags = ListField(StringField(), default=[])
#     tags_count = IntField(default=0, db_field='tagsCount')
# 
#     def is_active(self):
#         return self.active
# 
#     def is_admin(self):
#         return self.admin or False
# 
#     def __unicode__(self):
#         return self.username


# Path: models/shreds.py
from collections import Counter
from mongoengine import (
    StringField, IntField, DateTimeField, ListField, BooleanField,
    ReferenceField, EmbeddedDocument, EmbeddedDocumentField, FloatField,
    CASCADE, QuerySet)
from flask_mongoengine import Document
from .user import User
import datetime
import random
import jinja2






class Features(EmbeddedDocument):
    histogram_clean = ListField(IntField())
    height_mm = FloatField(required=True)
    histogram_full = ListField(IntField())
    width_mm = FloatField(required=True)
    area = IntField(required=True)
    dominant_colours = ListField(StringField())
    solidity = FloatField(required=True)
    colour_names = ListField(StringField())
    ratio = FloatField(required=True)
    width = IntField(required=True)
    height = IntField(required=True)


class ShredTags(EmbeddedDocument):
    user = ReferenceField(User)
    tags = ListField(StringField())
    recognizable_chars = StringField()
    angle = IntField(default=0)
    pages = ListField(ReferenceField("Pages"))


# Immutable once imported from CV.

class Shred(Document):