from ..models import BaseModel


class QueryCondition(BaseModel):
    """
    Represents a query condition object.

    'type': Enum with values ['structure', 'observation']
            Each value specifies type of query condition
    'id': Each condition has a unique numeric id assigned to it.
    'addable_column_id': Addable column id of the column to query on
    'value': value for the condition.
             Note: Certain wildcards that can be used while specifying the value -
                   "(defined)" is a wildcard matching all non-null values in query conditions.
                   "*" is a wildcard that matched any character zero or more times
    'value_type': Enum with values ['value', 'numeric_range', 'substructure']
                  'value' is used for simple query conditions not involving ranges of values.
                  'numeric_range' are used for range conditions
                  'substructure' is used for structure type conditions, to make search based on sketched substructure
    """

    _fields = ['type', 'id', 'addable_column_id', 'value', 'value_type']

    def __init__(self, type, id, value_type, addable_column_id=None, value=None):
        self.type = type
        self.id = id
        self.addable_column_id = addable_column_id
        self.value = value
        self.value_type = value_type
