syntax = "proto3";
package gaia.liquid.v1beta1;

import "cosmos/base/query/v1beta1/pagination.proto";
import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "gaia/liquid/v1beta1/liquid.proto";
import "cosmos/base/v1beta1/coin.proto";
import "cosmos/query/v1/query.proto";
import "amino/amino.proto";

option go_package = "github.com/cosmos/gaia/x/liquid/types";

// Query defines the gRPC querier service.
service Query {
  // LiquidValidators queries all liquid validators.
  //
  // When called from another module, this query might consume a high amount of
  // gas if the pagination field is incorrectly set.
  rpc LiquidValidators(QueryLiquidValidatorsRequest)
      returns (QueryLiquidValidatorsResponse) {
    option (cosmos.query.v1.module_query_safe) = true;
    option (google.api.http).get = "/gaia/liquid/v1beta1/liquid_validators";
  }

  // Query for an individual liquid validator by validator address
  rpc LiquidValidator(QueryLiquidValidatorRequest)
      returns (QueryLiquidValidatorResponse) {
    option (google.api.http).get =
        "/gaia/liquid/v1beta1/liquid_validator/{validator_addr}";
  }

  // Query for individual tokenize share record information by share by id
  rpc TokenizeShareRecordById(QueryTokenizeShareRecordByIdRequest)
      returns (QueryTokenizeShareRecordByIdResponse) {
    option (google.api.http).get =
        "/gaia/liquid/v1beta1/tokenize_share_record_by_id/{id}";
  }

  // Query for individual tokenize share record information by share denom
  rpc TokenizeShareRecordByDenom(QueryTokenizeShareRecordByDenomRequest)
      returns (QueryTokenizeShareRecordByDenomResponse) {
    option (google.api.http).get =
        "/gaia/liquid/v1beta1/tokenize_share_record_by_denom/{denom}";
  }

  // Query tokenize share records by address
  rpc TokenizeShareRecordsOwned(QueryTokenizeShareRecordsOwnedRequest)
      returns (QueryTokenizeShareRecordsOwnedResponse) {
    option (google.api.http).get =
        "/gaia/liquid/v1beta1/tokenize_share_record_owned/{owner}";
  }

  // Query for all tokenize share records
  rpc AllTokenizeShareRecords(QueryAllTokenizeShareRecordsRequest)
      returns (QueryAllTokenizeShareRecordsResponse) {
    option (google.api.http).get =
        "/gaia/liquid/v1beta1/tokenize_share_records";
  }

  // Query for last tokenize share record id
  rpc LastTokenizeShareRecordId(QueryLastTokenizeShareRecordIdRequest)
      returns (QueryLastTokenizeShareRecordIdResponse) {
    option (google.api.http).get =
        "/gaia/liquid/v1beta1/last_tokenize_share_record_id";
  }

  // Query for total tokenized staked assets
  rpc TotalTokenizeSharedAssets(QueryTotalTokenizeSharedAssetsRequest)
      returns (QueryTotalTokenizeSharedAssetsResponse) {
    option (google.api.http).get =
        "/gaia/liquid/v1beta1/total_tokenize_shared_assets";
  }

  // Query for total liquid staked (including tokenized shares or owned by an
  // liquid staking provider)
  rpc TotalLiquidStaked(QueryTotalLiquidStaked)
      returns (QueryTotalLiquidStakedResponse) {
    option (google.api.http).get = "/gaia/liquid/v1beta1/total_liquid_staked";
  }

  // Query tokenize share locks
  rpc TokenizeShareLockInfo(QueryTokenizeShareLockInfo)
      returns (QueryTokenizeShareLockInfoResponse) {
    option (google.api.http).get =
        "/gaia/liquid/v1beta1/tokenize_share_lock_info/{address}";
  }

  // Parameters queries the liquid parameters.
  rpc Params(QueryParamsRequest) returns (QueryParamsResponse) {
    option (cosmos.query.v1.module_query_safe) = true;
    option (google.api.http).get = "/gaia/liquid/v1beta1/params";
  }

  // TokenizeShareRecordReward queries the tokenize share record rewards
  rpc TokenizeShareRecordReward(QueryTokenizeShareRecordRewardRequest)
      returns (QueryTokenizeShareRecordRewardResponse) {
    option (google.api.http).get =
        "/gaia/liquid/v1beta1/{owner_address}/tokenize_share_record_rewards";
  }
}

// QueryLiquidValidatorRequest is the request type for the Query/LiquidValidator
// RPC method.
message QueryLiquidValidatorRequest { string validator_addr = 1; }

// QueryLiquidValidatorResponse is the response type for the
// Query/LiquidValidator RPC method.
message QueryLiquidValidatorResponse {
  LiquidValidator liquid_validator = 1
      [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}

// QueryLiquidValidatorsRequest is request type for the
// Query/QueryLiquidValidators RPC method.
message QueryLiquidValidatorsRequest {
  // pagination defines an optional pagination for the request.
  cosmos.base.query.v1beta1.PageRequest pagination = 1;
}

// QueryLiquidValidatorsResponse is response type for the
// Query/QueryLiquidValidators RPC method.
message QueryLiquidValidatorsResponse {
  repeated LiquidValidator liquid_validators = 1
      [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
  // pagination defines the pagination in the response.
  cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

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

// QueryParamsResponse is response type for the Query/Params RPC method.
message QueryParamsResponse {
  // params holds all the parameters of this module.
  Params params = 1
      [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ];
}

// QueryTokenizeShareRecordByIdRequest is request type for the
// Query/QueryTokenizeShareRecordById RPC method.
message QueryTokenizeShareRecordByIdRequest { uint64 id = 1; }

// QueryTokenizeShareRecordByIdRequest is response type for the
// Query/QueryTokenizeShareRecordById RPC method.
message QueryTokenizeShareRecordByIdResponse {
  TokenizeShareRecord record = 1 [ (gogoproto.nullable) = false ];
}

// QueryTokenizeShareRecordByDenomRequest is request type for the
// Query/QueryTokenizeShareRecordByDenom RPC method.
message QueryTokenizeShareRecordByDenomRequest { string denom = 1; }

// QueryTokenizeShareRecordByDenomResponse is response type for the
// Query/QueryTokenizeShareRecordByDenom RPC method.
message QueryTokenizeShareRecordByDenomResponse {
  TokenizeShareRecord record = 1 [ (gogoproto.nullable) = false ];
}

// QueryTokenizeShareRecordsOwnedRequest is request type for the
// Query/QueryTokenizeShareRecordsOwned RPC method.
message QueryTokenizeShareRecordsOwnedRequest { string owner = 1; }

// QueryTokenizeShareRecordsOwnedResponse is response type for the
// Query/QueryTokenizeShareRecordsOwned RPC method.
message QueryTokenizeShareRecordsOwnedResponse {
  repeated TokenizeShareRecord records = 1 [ (gogoproto.nullable) = false ];
}

// QueryAllTokenizeShareRecordsRequest is request type for the
// Query/QueryAllTokenizeShareRecords RPC method.
message QueryAllTokenizeShareRecordsRequest {
  // pagination defines an optional pagination for the request.
  cosmos.base.query.v1beta1.PageRequest pagination = 1;
}

// QueryAllTokenizeShareRecordsResponse is response type for the
// Query/QueryAllTokenizeShareRecords RPC method.
message QueryAllTokenizeShareRecordsResponse {
  repeated TokenizeShareRecord records = 1 [ (gogoproto.nullable) = false ];
  // pagination defines the pagination in the response.
  cosmos.base.query.v1beta1.PageResponse pagination = 2;
}

// QueryLastTokenizeShareRecordIdRequest is request type for the
// Query/QueryLastTokenizeShareRecordId RPC method.
message QueryLastTokenizeShareRecordIdRequest {}

// QueryLastTokenizeShareRecordIdResponse is response type for the
// Query/QueryLastTokenizeShareRecordId RPC method.
message QueryLastTokenizeShareRecordIdResponse { uint64 id = 1; }

// QueryTotalTokenizeSharedAssetsRequest is request type for the
// Query/QueryTotalTokenizeSharedAssets RPC method.
message QueryTotalTokenizeSharedAssetsRequest {}

// QueryTotalTokenizeSharedAssetsResponse is response type for the
// Query/QueryTotalTokenizeSharedAssets RPC method.
message QueryTotalTokenizeSharedAssetsResponse {
  cosmos.base.v1beta1.Coin value = 1 [ (gogoproto.nullable) = false ];
}

// QueryTotalLiquidStakedRequest is request type for the
// Query/QueryQueryTotalLiquidStaked RPC method.
message QueryTotalLiquidStaked {}

// QueryTotalLiquidStakedResponse is response type for the
// Query/QueryQueryTotalLiquidStaked RPC method.
message QueryTotalLiquidStakedResponse { string tokens = 1; }

// QueryTokenizeShareLockInfo queries the tokenize share lock information
// associated with given account
message QueryTokenizeShareLockInfo { string address = 1; }

// QueryTokenizeShareLockInfoResponse is the response from the
// QueryTokenizeShareLockInfo query
message QueryTokenizeShareLockInfoResponse {
  string status = 1;
  string expiration_time = 2;
}

// QueryTokenizeShareRecordRewardRequest is the request type for the
// Query/TokenizeShareRecordReward RPC method.
message QueryTokenizeShareRecordRewardRequest {
  option (gogoproto.equal) = false;
  option (gogoproto.goproto_getters) = false;

  string owner_address = 1 [ (gogoproto.moretags) = "yaml:\"owner_address\"" ];
}

// QueryTokenizeShareRecordRewardResponse is the response type for the
// Query/TokenizeShareRecordReward RPC method.
message QueryTokenizeShareRecordRewardResponse {
  // rewards defines all the rewards accrued by a delegator.
  repeated TokenizeShareRecordReward rewards = 1
      [ (gogoproto.nullable) = false ];
  // total defines the sum of all the rewards.
  repeated cosmos.base.v1beta1.DecCoin total = 2 [
    (gogoproto.nullable) = false,
    (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins"
  ];
}