syntax = "proto3";

package rated;

message StringValue {
  string value = 1;
}

message UInt64Value {
	uint64 value = 1;
}

enum MatchType {
	EXACT = 0;
	PARTIAL = 1;
}

message VersionResponse
{
	uint64 major = 1;
	uint64 minor = 2;
	uint64 patch = 3;
}

message HSLRateRequest {
	message Filter {
		message Namespace {
			string value = 1;
			MatchType type = 2;
		}
		Namespace namespace = 1;
		message Entry {
			string value = 1;
			MatchType type = 2;
		}
		Entry entry = 2;
		UInt64Value count = 3;
		bool synced = 4;
	}
	Filter filter = 1;
	message Paging {
		StringValue namespace = 1;
		StringValue entry = 2;
		uint64 limit = 3;
	}
	Paging paging = 2;
}

message HSLRateResponse {
	message Item {
		string namespace = 1;
		string entry = 2;
		uint64 count = 3;
		uint64 localcount = 4;
		uint64 oldest = 5;
		uint64 newest = 6;
	}
	repeated Item items = 1;
}

message HSLRateClearRequest {
	message Namespace {
		string value = 1;
		MatchType type = 2;
	}
	Namespace namespace = 1;
	message Entry {
		string value = 1;
		MatchType type = 2;
	}
	Entry entry = 2;
	UInt64Value count = 3;
}

message HSLRateClearResponse {
	uint64 affected = 1;
}
