# Path: mass_flask_core/models/analysis_system.py
# class AnalysisSystem(db.Document):
#     identifier_name = StringField(min_length=3, max_length=50, unique=True, required=True)
#     verbose_name = StringField(max_length=200, required=True)
#     information_text = StringField()
#     tag_filter_expression = StringField(max_length=400, required=True, default='')
# 
#     meta = {
#         'ordering': ['identifier_name'],
#         'indexes': ['identifier_name']
#     }
# 
#     def __repr__(self):
#         return '[AnalysisSystem] {}'.format(self.identifier_name)
# 
#     def __str__(self):
#         return self.__repr__()


from flask_wtf import Form
from wtforms import SelectField, IntegerField, SubmitField
from wtforms.validators import InputRequired
from mass_flask_core.models import AnalysisSystem


class RequestAnalysisForm(Form):
    analysis_system = SelectField('Analysis system', choices=[], validators=[InputRequired()])
    priority = IntegerField('Priority', validators=[InputRequired()], default=0)
    submit = SubmitField('Request')

    def __init__(self):
        super(RequestAnalysisForm, self).__init__()
        self._query_analysis_system_choices()

    def _query_analysis_system_choices(self):
        analysis_systems = []

# Path: mass_flask_core/models/analysis_system.py
# class AnalysisSystem(db.Document):
#     identifier_name = StringField(min_length=3, max_length=50, unique=True, required=True)
#     verbose_name = StringField(max_length=200, required=True)
#     information_text = StringField()
#     tag_filter_expression = StringField(max_length=400, required=True, default='')
# 
#     meta = {
#         'ordering': ['identifier_name'],
#         'indexes': ['identifier_name']
#     }
# 
#     def __repr__(self):
#         return '[AnalysisSystem] {}'.format(self.identifier_name)
# 
#     def __str__(self):
#         return self.__repr__()


# Path: mass_flask_webui/forms/request_analysis.py
from flask_wtf import Form
from wtforms import SelectField, IntegerField, SubmitField
from wtforms.validators import InputRequired
from mass_flask_core.models import AnalysisSystem



class RequestAnalysisForm(Form):
    analysis_system = SelectField('Analysis system', choices=[], validators=[InputRequired()])
    priority = IntegerField('Priority', validators=[InputRequired()], default=0)
    submit = SubmitField('Request')

    def __init__(self):
        super(RequestAnalysisForm, self).__init__()
        self._query_analysis_system_choices()

    def _query_analysis_system_choices(self):
        analysis_systems = []

        for system in AnalysisSystem.objects: