package NWebmaster.proto.querygroups;
option java_package = "ru.yandex.webmaster3.proto.querygroups";

enum QueryFilterType {
    LESS_THAN        = 1;
    LESS_OR_EQUAL    = 2;
    GREATER_THAN     = 3;
    GREATER_OR_EQUAL = 4;
    MATCHES_REGEXP   = 5;
}

enum QueryIndicator {
    QUERY                  = 1;
    URL                    = 2;
    SHOWS_COUNT            = 3;
    CLICKS_COUNT           = 4;
    CTR                    = 5;
    AVERAGE_SHOW_POSITION  = 6;
    AVERAGE_CLICK_POSITION = 7;
}

message QueryFilter {
    required QueryFilterType type           = 1;
    optional QueryIndicator indicator       = 2;
    optional int32 indicator_from_position  = 3;
    optional int32 indicator_until_position = 4;
    optional string filter_text             = 5;
    optional float filter_value             = 6;
}

enum FilterExpressionType {
    FILTER  = 1;
    NOT     = 2;
    AND     = 3;
    OR      = 4;
}

message FilterExpression {
    required FilterExpressionType type              = 1;
    optional QueryFilter filter                     = 2;
    repeated FilterExpression filter_expressions    = 3;
}

message QueryInfo {
    required string text = 1;
}

message UrlInfo {
    required string path = 1;
}

message HostGroupInfo {
    required bool favorite                      = 1;
    required int64 creation_timestamp           = 2;
    repeated QueryInfo queries                  = 3;
    optional FilterExpression filter_expression = 4;
    repeated UrlInfo urls                       = 5;
}
