syntax = "proto3";
package cosmos.circuit.v1;

option go_package = "cosmossdk.io/x/circuit/types";

// Permissions are the permissions that an account has to trip
// or reset the circuit breaker.
message Permissions {
  // level is the level of permissions granted to this account.
  Level level = 1;

  // limit_type_urls is used with LEVEL_SOME_MSGS to limit the lists of Msg type
  // URLs that the account can trip. It is an error to use limit_type_urls with
  // a level other than LEVEL_SOME_MSGS.
  repeated string limit_type_urls = 2;

  // Level is the permission level.
  enum Level {
    // LEVEL_NONE_UNSPECIFIED indicates that the account will have no circuit
    // breaker permissions.
    LEVEL_NONE_UNSPECIFIED = 0;

    // LEVEL_SOME_MSGS indicates that the account will have permission to
    // trip or reset the circuit breaker for some Msg type URLs. If this level
    // is chosen, a non-empty list of Msg type URLs must be provided in
    // limit_type_urls.
    LEVEL_SOME_MSGS = 1;

    // LEVEL_ALL_MSGS indicates that the account can trip or reset the circuit
    // breaker for Msg's of all type URLs.
    LEVEL_ALL_MSGS = 2;

    // LEVEL_SUPER_ADMIN indicates that the account can take all circuit breaker
    // actions and can grant permissions to other accounts.
    LEVEL_SUPER_ADMIN = 3;
  }
}

// GenesisAccountPermissions is the account permissions for the circuit breaker in genesis
message GenesisAccountPermissions {
  string      address     = 1;
  Permissions permissions = 2;
}

// GenesisState is the state that must be provided at genesis.
message GenesisState {
  repeated GenesisAccountPermissions account_permissions = 1;
  repeated string                    disabled_type_urls  = 2;
}
