syntax = "proto3";
package akash.cert.v1beta2;

import "gogoproto/gogo.proto";
import "google/api/annotations.proto";
import "cosmos/base/query/v1beta1/pagination.proto";
import "akash/cert/v1beta2/cert.proto";

option go_package = "github.com/akash-network/akash-api/go/node/cert/v1beta2";

// Query defines the gRPC querier service
service Query {
  // Certificates queries certificates
  rpc Certificates(QueryCertificatesRequest) returns (QueryCertificatesResponse) {
    option (google.api.http).get = "/akash/cert/v1beta3/certificates/list";
  }
}

// CertificateResponse contains a single X509 certificate and its serial number
message CertificateResponse {
  Certificate certificate = 1 [
    (gogoproto.nullable) = false,
    (gogoproto.jsontag) = "certificate",
    (gogoproto.moretags) = "yaml:\"certificate\""
  ];

  string serial = 2 [
    (gogoproto.jsontag) = "serial",
    (gogoproto.moretags) = "yaml:\"serial\""
  ];
}

// QueryDeploymentsRequest is request type for the Query/Deployments RPC method
message QueryCertificatesRequest {
  CertificateFilter filter = 1 [
    (gogoproto.nullable) = false
  ];

  cosmos.base.query.v1beta1.PageRequest pagination = 2;
}

// QueryCertificatesResponse is response type for the Query/Certificates RPC method
message QueryCertificatesResponse {
  repeated CertificateResponse certificates = 1 [
    (gogoproto.nullable) = false,
    (gogoproto.castrepeated) = "CertificatesResponse"
  ];

  cosmos.base.query.v1beta1.PageResponse pagination = 2;
}
