syntax = "proto3";
package sentinel.subscription.v1;

option go_package = "github.com/sentinel-official/hub/x/subscription/types";

import "cosmos/base/query/v1beta1/pagination.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "sentinel/subscription/v1/quota.proto";
import "sentinel/types/v1/status.proto";
import "sentinel/subscription/v1/subscription.proto";
import "sentinel/subscription/v1/params.proto";

option (gogoproto.equal_all)           = false;
option (gogoproto.goproto_getters_all) = false;

message QuerySubscriptionsRequest {
  cosmos.base.query.v1beta1.PageRequest pagination = 1;
}

message QuerySubscriptionsForAddressRequest {
  string address                                   = 1;
  sentinel.types.v1.Status status                  = 2;
  cosmos.base.query.v1beta1.PageRequest pagination = 3;
}

message QuerySubscriptionRequest { uint64 id = 1; }

message QueryQuotaRequest {
  uint64 id      = 1;
  string address = 2;
}

message QueryQuotasRequest {
  uint64 id                                        = 1;
  cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

message QueryParamsRequest {}

message QuerySubscriptionsResponse {
  repeated Subscription subscriptions = 1 [ (gogoproto.nullable) = false ];
  cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

message QuerySubscriptionsForAddressResponse {
  repeated Subscription subscriptions = 1 [ (gogoproto.nullable) = false ];
  cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

message QuerySubscriptionResponse {
  Subscription subscription = 1 [ (gogoproto.nullable) = false ];
}

message QueryQuotaResponse { Quota quota = 1 [ (gogoproto.nullable) = false ]; }

message QueryQuotasResponse {
  repeated Quota quotas = 1 [ (gogoproto.nullable) = false ];
  cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

message QueryParamsResponse {
  Params params = 1 [ (gogoproto.nullable) = false ];
}

service QueryService {
  rpc QuerySubscriptions(QuerySubscriptionsRequest)
      returns (QuerySubscriptionsResponse) {
    option (google.api.http).get = "/sentinel/subscriptions";
  }

  rpc QuerySubscriptionsForAddress(QuerySubscriptionsForAddressRequest)
      returns (QuerySubscriptionsForAddressResponse) {
    option (google.api.http).get = "/sentinel/accounts/{address}/subscriptions";
  }

  rpc QuerySubscription(QuerySubscriptionRequest)
      returns (QuerySubscriptionResponse) {
    option (google.api.http).get = "/sentinel/subscriptions/{id}";
  }

  rpc QueryQuota(QueryQuotaRequest) returns (QueryQuotaResponse) {
    option (google.api.http).get =
        "/accounts/{address}/subscriptions/{id}/quotas";
  }

  rpc QueryQuotas(QueryQuotasRequest) returns (QueryQuotasResponse) {
    option (google.api.http).get = "/sentinel/subscriptions/{id}/quotas";
  }

  rpc QueryParams(QueryParamsRequest) returns (QueryParamsResponse) {
    option (google.api.http).get = "/sentinel/modules/subscription/params";
  }
}
