syntax = "proto3";

package ibc.core.client.v1;

option go_package = "github.com/cosmos/ibc-go/v6/modules/core/02-client/types";

import "ibc/core/client/v1/client.proto";
import "gogoproto/gogo.proto";

// GenesisState defines the ibc client submodule's genesis state.
message GenesisState {
  // client states with their corresponding identifiers
  repeated IdentifiedClientState clients = 1
      [(gogoproto.nullable) = false, (gogoproto.castrepeated) = "IdentifiedClientStates"];
  // consensus states from each client
  repeated ClientConsensusStates clients_consensus = 2 [
    (gogoproto.nullable)     = false,
    (gogoproto.castrepeated) = "ClientsConsensusStates",
    (gogoproto.moretags)     = "yaml:\"clients_consensus\""
  ];
  // metadata from each client
  repeated IdentifiedGenesisMetadata clients_metadata = 3
      [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"clients_metadata\""];
  Params params = 4 [(gogoproto.nullable) = false];
  // create localhost on initialization
  bool create_localhost = 5 [(gogoproto.moretags) = "yaml:\"create_localhost\""];
  // the sequence for the next generated client identifier
  uint64 next_client_sequence = 6 [(gogoproto.moretags) = "yaml:\"next_client_sequence\""];
}

// GenesisMetadata defines the genesis type for metadata that clients may return
// with ExportMetadata
message GenesisMetadata {
  option (gogoproto.goproto_getters) = false;

  // store key of metadata without clientID-prefix
  bytes key = 1;
  // metadata value
  bytes value = 2;
}

// IdentifiedGenesisMetadata has the client metadata with the corresponding
// client id.
message IdentifiedGenesisMetadata {
  string                   client_id       = 1 [(gogoproto.moretags) = "yaml:\"client_id\""];
  repeated GenesisMetadata client_metadata = 2
      [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"client_metadata\""];
}
