syntax = "proto3";

package filter_list_manager;

option java_multiple_files = true;
option java_package = "com.adguard.flm.protobuf";
option java_outer_classname = "MiscModelsProto";

import "filters.proto";

// ActiveRulesInfo
message ActiveRulesInfo {
  // Filter id for these rules
  int32 filter_id = 1;

  // Group id of the filter
  int32 group_id = 2;

  // Is this filter trusted?
  bool is_trusted = 3;

  // List of active rules.
  repeated string rules = 4;
}

// ActiveRulesInfo raw
message ActiveRulesInfoRaw {
  // Filter id for these rules
  int32 filter_id = 1;

  // Group id of the filter
  int32 group_id = 2;

  // Is this filter trusted?
  bool is_trusted = 3;

  // List of active rules as string.
  string rules = 4;
}

// UpdateResult
message UpdateResult {
  // Currently updated filters.
  repeated FullFilterList updated_list = 1;

  // Number of filters not updated due to timeout.
  int32 remaining_filters_count = 2;

  // List of entities containing the filter id and a string representation of the error
  repeated UpdateFilterError filters_errors = 3;
}

// UpdateFilterError
message UpdateFilterError {
  // ID of that filter that couldn't be updated
  int32 filter_id = 1;

  // Filter error converted to a string. For debugging purposes
  string message = 2;

  // Filter url
  optional string filter_url = 3;

  // Http client error
  optional string http_client_error = 4;
}

// Information about filter movement during index metadata update
message MovedFilterInfo {
  /// Previous id of the filter
  int32 previous_id = 1;

  /// New id of the filter
  int32 new_id = 2;
}

// Result of index metadata update
message PullMetadataResult {
  // List of filters added in the update
  repeated int32 added_filters = 1;

  // List of filters removed in the update
  repeated int32 removed_filters = 2;

  // List of filters moved in the update
  repeated MovedFilterInfo moved_filters = 3;
}
