syntax = "proto3";

package ibc.applications.interchain_accounts.v1;

option go_package = "github.com/cosmos/ibc-go/v3/modules/apps/27-interchain-accounts/types";

import "gogoproto/gogo.proto";
import "ibc/applications/interchain_accounts/controller/v1/controller.proto";
import "ibc/applications/interchain_accounts/host/v1/host.proto";

// GenesisState defines the interchain accounts genesis state
message GenesisState {
  ControllerGenesisState controller_genesis_state = 1
      [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"controller_genesis_state\""];
  HostGenesisState host_genesis_state = 2
      [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"host_genesis_state\""];
}

// ControllerGenesisState defines the interchain accounts controller genesis state
message ControllerGenesisState {
  repeated ActiveChannel active_channels = 1
      [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"active_channels\""];
  repeated RegisteredInterchainAccount interchain_accounts = 2
      [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"interchain_accounts\""];
  repeated string                                           ports  = 3;
  ibc.applications.interchain_accounts.controller.v1.Params params = 4 [(gogoproto.nullable) = false];
}

// HostGenesisState defines the interchain accounts host genesis state
message HostGenesisState {
  repeated ActiveChannel active_channels = 1
      [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"active_channels\""];
  repeated RegisteredInterchainAccount interchain_accounts = 2
      [(gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"interchain_accounts\""];
  string                                              port   = 3;
  ibc.applications.interchain_accounts.host.v1.Params params = 4 [(gogoproto.nullable) = false];
}

// ActiveChannel contains a connection ID, port ID and associated active channel ID
message ActiveChannel {
  string connection_id = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""];
  string port_id       = 2 [(gogoproto.moretags) = "yaml:\"port_id\""];
  string channel_id    = 3 [(gogoproto.moretags) = "yaml:\"channel_id\""];
}

// RegisteredInterchainAccount contains a connection ID, port ID and associated interchain account address
message RegisteredInterchainAccount {
  string connection_id   = 1 [(gogoproto.moretags) = "yaml:\"connection_id\""];
  string port_id         = 2 [(gogoproto.moretags) = "yaml:\"port_id\""];
  string account_address = 3 [(gogoproto.moretags) = "yaml:\"account_address\""];
}