//@ts-nocheck
import { Permissions } from "./types";
import * as _m0 from "protobufjs/minimal";
import { isSet } from "../../../helpers";
/** MsgAuthorizeCircuitBreaker defines the Msg/AuthorizeCircuitBreaker request type. */

/** MsgAuthorizeCircuitBreaker defines the Msg/AuthorizeCircuitBreaker request type. */

/** MsgAuthorizeCircuitBreakerResponse defines the Msg/AuthorizeCircuitBreaker response type. */

/** MsgAuthorizeCircuitBreakerResponse defines the Msg/AuthorizeCircuitBreaker response type. */

/** MsgTripCircuitBreaker defines the Msg/TripCircuitBreaker request type. */

/** MsgTripCircuitBreaker defines the Msg/TripCircuitBreaker request type. */

/** MsgTripCircuitBreakerResponse defines the Msg/TripCircuitBreaker response type. */

/** MsgTripCircuitBreakerResponse defines the Msg/TripCircuitBreaker response type. */

/** MsgResetCircuitBreaker defines the Msg/ResetCircuitBreaker request type. */

/** MsgResetCircuitBreaker defines the Msg/ResetCircuitBreaker request type. */

/** MsgResetCircuitBreakerResponse defines the Msg/ResetCircuitBreaker response type. */

/** MsgResetCircuitBreakerResponse defines the Msg/ResetCircuitBreaker response type. */

function createBaseMsgAuthorizeCircuitBreaker() {
  return {
    granter: "",
    grantee: "",
    permissions: undefined
  };
}
export const MsgAuthorizeCircuitBreaker = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.granter !== "") {
      writer.uint32(10).string(message.granter);
    }
    if (message.grantee !== "") {
      writer.uint32(18).string(message.grantee);
    }
    if (message.permissions !== undefined) {
      Permissions.encode(message.permissions, writer.uint32(26).fork()).ldelim();
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgAuthorizeCircuitBreaker();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.granter = reader.string();
          break;
        case 2:
          message.grantee = reader.string();
          break;
        case 3:
          message.permissions = Permissions.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      granter: isSet(object.granter) ? String(object.granter) : "",
      grantee: isSet(object.grantee) ? String(object.grantee) : "",
      permissions: isSet(object.permissions) ? Permissions.fromJSON(object.permissions) : undefined
    };
  },
  toJSON(message) {
    const obj = {};
    message.granter !== undefined && (obj.granter = message.granter);
    message.grantee !== undefined && (obj.grantee = message.grantee);
    message.permissions !== undefined && (obj.permissions = message.permissions ? Permissions.toJSON(message.permissions) : undefined);
    return obj;
  },
  fromPartial(object) {
    var _object$granter, _object$grantee;
    const message = createBaseMsgAuthorizeCircuitBreaker();
    message.granter = (_object$granter = object.granter) !== null && _object$granter !== void 0 ? _object$granter : "";
    message.grantee = (_object$grantee = object.grantee) !== null && _object$grantee !== void 0 ? _object$grantee : "";
    message.permissions = object.permissions !== undefined && object.permissions !== null ? Permissions.fromPartial(object.permissions) : undefined;
    return message;
  }
};
function createBaseMsgAuthorizeCircuitBreakerResponse() {
  return {
    success: false
  };
}
export const MsgAuthorizeCircuitBreakerResponse = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.success === true) {
      writer.uint32(8).bool(message.success);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgAuthorizeCircuitBreakerResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.success = reader.bool();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      success: isSet(object.success) ? Boolean(object.success) : false
    };
  },
  toJSON(message) {
    const obj = {};
    message.success !== undefined && (obj.success = message.success);
    return obj;
  },
  fromPartial(object) {
    var _object$success;
    const message = createBaseMsgAuthorizeCircuitBreakerResponse();
    message.success = (_object$success = object.success) !== null && _object$success !== void 0 ? _object$success : false;
    return message;
  }
};
function createBaseMsgTripCircuitBreaker() {
  return {
    authority: "",
    msgTypeUrls: []
  };
}
export const MsgTripCircuitBreaker = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.authority !== "") {
      writer.uint32(10).string(message.authority);
    }
    for (const v of message.msgTypeUrls) {
      writer.uint32(18).string(v);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgTripCircuitBreaker();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.authority = reader.string();
          break;
        case 2:
          message.msgTypeUrls.push(reader.string());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      authority: isSet(object.authority) ? String(object.authority) : "",
      msgTypeUrls: Array.isArray(object === null || object === void 0 ? void 0 : object.msgTypeUrls) ? object.msgTypeUrls.map(e => String(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.authority !== undefined && (obj.authority = message.authority);
    if (message.msgTypeUrls) {
      obj.msgTypeUrls = message.msgTypeUrls.map(e => e);
    } else {
      obj.msgTypeUrls = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$authority, _object$msgTypeUrls;
    const message = createBaseMsgTripCircuitBreaker();
    message.authority = (_object$authority = object.authority) !== null && _object$authority !== void 0 ? _object$authority : "";
    message.msgTypeUrls = ((_object$msgTypeUrls = object.msgTypeUrls) === null || _object$msgTypeUrls === void 0 ? void 0 : _object$msgTypeUrls.map(e => e)) || [];
    return message;
  }
};
function createBaseMsgTripCircuitBreakerResponse() {
  return {
    success: false
  };
}
export const MsgTripCircuitBreakerResponse = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.success === true) {
      writer.uint32(8).bool(message.success);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgTripCircuitBreakerResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.success = reader.bool();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      success: isSet(object.success) ? Boolean(object.success) : false
    };
  },
  toJSON(message) {
    const obj = {};
    message.success !== undefined && (obj.success = message.success);
    return obj;
  },
  fromPartial(object) {
    var _object$success2;
    const message = createBaseMsgTripCircuitBreakerResponse();
    message.success = (_object$success2 = object.success) !== null && _object$success2 !== void 0 ? _object$success2 : false;
    return message;
  }
};
function createBaseMsgResetCircuitBreaker() {
  return {
    authority: "",
    msgTypeUrls: []
  };
}
export const MsgResetCircuitBreaker = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.authority !== "") {
      writer.uint32(10).string(message.authority);
    }
    for (const v of message.msgTypeUrls) {
      writer.uint32(26).string(v);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgResetCircuitBreaker();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.authority = reader.string();
          break;
        case 3:
          message.msgTypeUrls.push(reader.string());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      authority: isSet(object.authority) ? String(object.authority) : "",
      msgTypeUrls: Array.isArray(object === null || object === void 0 ? void 0 : object.msgTypeUrls) ? object.msgTypeUrls.map(e => String(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.authority !== undefined && (obj.authority = message.authority);
    if (message.msgTypeUrls) {
      obj.msgTypeUrls = message.msgTypeUrls.map(e => e);
    } else {
      obj.msgTypeUrls = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$authority2, _object$msgTypeUrls2;
    const message = createBaseMsgResetCircuitBreaker();
    message.authority = (_object$authority2 = object.authority) !== null && _object$authority2 !== void 0 ? _object$authority2 : "";
    message.msgTypeUrls = ((_object$msgTypeUrls2 = object.msgTypeUrls) === null || _object$msgTypeUrls2 === void 0 ? void 0 : _object$msgTypeUrls2.map(e => e)) || [];
    return message;
  }
};
function createBaseMsgResetCircuitBreakerResponse() {
  return {
    success: false
  };
}
export const MsgResetCircuitBreakerResponse = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.success === true) {
      writer.uint32(8).bool(message.success);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseMsgResetCircuitBreakerResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.success = reader.bool();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      success: isSet(object.success) ? Boolean(object.success) : false
    };
  },
  toJSON(message) {
    const obj = {};
    message.success !== undefined && (obj.success = message.success);
    return obj;
  },
  fromPartial(object) {
    var _object$success3;
    const message = createBaseMsgResetCircuitBreakerResponse();
    message.success = (_object$success3 = object.success) !== null && _object$success3 !== void 0 ? _object$success3 : false;
    return message;
  }
};