syntax = "proto3";
package band.restake.v1beta1;

option go_package = "github.com/bandprotocol/chain/v3/x/restake/types";

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "cosmos_proto/cosmos.proto";
import "band/restake/v1beta1/types.proto";
import "band/restake/v1beta1/genesis.proto";

// Query defines the gRPC querier service.
service Query {
  // Vaults returns a list of vault.
  rpc Vaults(QueryVaultsRequest) returns (QueryVaultsResponse) {
    option (google.api.http).get = "/restake/v1beta1/vaults";
  }

  // Vault returns a vault information.
  rpc Vault(QueryVaultRequest) returns (QueryVaultResponse) {
    option (google.api.http).get = "/restake/v1beta1/vaults/{key}";
  }

  // Locks returns all lock information for a specified address.
  rpc Locks(QueryLocksRequest) returns (QueryLocksResponse) {
    option (google.api.http).get = "/restake/v1beta1/stakers/{staker_address}/locks";
  }

  // Lock returns a lock information for a specified address and a vault.
  rpc Lock(QueryLockRequest) returns (QueryLockResponse) {
    option (google.api.http).get = "/restake/v1beta1/stakers/{staker_address}/locks/{key}";
  }

  // Stake returns stake information for a specific address.
  rpc Stake(QueryStakeRequest) returns (QueryStakeResponse) {
    option (google.api.http).get = "/restake/v1beta1/stakers/{staker_address}/stake";
  }

  // Params returns all parameters of the module.
  rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
    option (google.api.http).get = "/restake/v1beta1/params";
  }
}

// QueryVaultsRequest represents the request type for the Query/Vaults RPC method.
message QueryVaultsRequest {
  // pagination defines optional pagination parameters.
  cosmos.base.query.v1beta1.PageRequest pagination = 1;
}

// QueryVaultsResponse represents the response type for the Query/Vaults RPC method.
message QueryVaultsResponse {
  // vaults is a list of vaults.
  repeated Vault vaults = 1;

  // pagination defines pagination parameters in the response.
  cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryVaultRequest represents the request type for the Query/Vault RPC method.
message QueryVaultRequest {
  // key is the key of the vault that want to query.
  string key = 1;
}

// QueryVaultResponse represents the response type for the Query/Vault RPC method.
message QueryVaultResponse {
  // vault is a vault information.
  Vault vault = 1 [(gogoproto.nullable) = false];
}

// QueryLocksRequest represents the request type for the Query/Locks RPC method.
message QueryLocksRequest {
  // staker_address is the target address to query locks.
  string staker_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

  // pagination defines optional pagination parameters.
  cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// QueryLocksResponse represents the response type for the Query/Locks RPC method.
message QueryLocksResponse {
  // locks is a list of locks of the staker.
  repeated LockResponse locks = 1;

  // pagination defines pagination parameters in the response.
  cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryLockRequest represents the request type for the Query/Lock RPC method.
message QueryLockRequest {
  // staker_address is the target address to query lock.
  string staker_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];

  // key is the key of target vault to query lock.
  string key = 2;
}

// QueryLockResponse represents the response type for the Query/Lock RPC method.
message QueryLockResponse {
  // lock is the lock of the staker and the vault.
  LockResponse lock = 1 [(gogoproto.nullable) = false];
}

// QueryStakeRequest represents the request type for the Query/Stake RPC method.
message QueryStakeRequest {
  // staker_address is the target address used to query the stake.
  string staker_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
}

// QueryStakeResponse represents the response type for the Query/Stake RPC method.
message QueryStakeResponse {
  // stake is a stake information of the staker.
  Stake stake = 1 [(gogoproto.nullable) = false];
}

// QueryParamsRequest is the request type for the Query/Params RPC method.
message QueryParamsRequest {}

// QueryParamsResponse is the response type for the Query/Params RPC method.
message QueryParamsResponse {
  // params are the parameters of the module.
  Params params = 1 [(gogoproto.nullable) = false];
}
