"use strict";

var _typeof = require("@babel/runtime/helpers/typeof");
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.EntityVerifiedUpdatedEvent = exports.EntityUpdatedEvent = exports.EntityTransferredEvent = exports.EntityCreatedEvent = exports.EntityAccountCreatedEvent = exports.EntityAccountAuthzRevokedEvent = exports.EntityAccountAuthzCreatedEvent = void 0;
var _entity = require("./entity");
var _authz = require("../../../cosmos/authz/v1beta1/authz");
var _m0 = _interopRequireWildcard(require("protobufjs/minimal"));
var _helpers = require("../../../helpers");
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, "default": e }; if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (var _t in e) "default" !== _t && {}.hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); return f; })(e, t); }
//@ts-nocheck

/** EntityCreatedEvent is an event triggered on a Entity creation */

/** EntityCreatedEvent is an event triggered on a Entity creation */

/** EntityUpdatedEvent is an event triggered on a entity document update */

/** EntityUpdatedEvent is an event triggered on a entity document update */

/**
 * EntityVerifiedUpdatedEvent is an event triggered on a entity verified
 * document update
 */

/**
 * EntityVerifiedUpdatedEvent is an event triggered on a entity verified
 * document update
 */

/** EntityTransferredEvent is an event triggered on a entity transfer */

/** EntityTransferredEvent is an event triggered on a entity transfer */

/** EntityAccountCreatedEvent is an event triggered on a entity account creation */

/** EntityAccountCreatedEvent is an event triggered on a entity account creation */

/**
 * EntityAccountCreatedEvent is an event triggered on a entity account authz
 * creation
 */

/**
 * EntityAccountCreatedEvent is an event triggered on a entity account authz
 * creation
 */

/**
 * EntityAccountAuthzRevokedEvent is an event triggered on a entity account
 * authz revocation
 */

/**
 * EntityAccountAuthzRevokedEvent is an event triggered on a entity account
 * authz revocation
 */

function createBaseEntityCreatedEvent() {
  return {
    entity: undefined,
    signer: ""
  };
}
var EntityCreatedEvent = exports.EntityCreatedEvent = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.entity !== undefined) {
      _entity.Entity.encode(message.entity, writer.uint32(10).fork()).ldelim();
    }
    if (message.signer !== "") {
      writer.uint32(18).string(message.signer);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseEntityCreatedEvent();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.entity = _entity.Entity.decode(reader, reader.uint32());
          break;
        case 2:
          message.signer = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      entity: (0, _helpers.isSet)(object.entity) ? _entity.Entity.fromJSON(object.entity) : undefined,
      signer: (0, _helpers.isSet)(object.signer) ? String(object.signer) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.entity !== undefined && (obj.entity = message.entity ? _entity.Entity.toJSON(message.entity) : undefined);
    message.signer !== undefined && (obj.signer = message.signer);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$signer;
    var message = createBaseEntityCreatedEvent();
    message.entity = object.entity !== undefined && object.entity !== null ? _entity.Entity.fromPartial(object.entity) : undefined;
    message.signer = (_object$signer = object.signer) !== null && _object$signer !== void 0 ? _object$signer : "";
    return message;
  }
};
function createBaseEntityUpdatedEvent() {
  return {
    entity: undefined,
    signer: ""
  };
}
var EntityUpdatedEvent = exports.EntityUpdatedEvent = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.entity !== undefined) {
      _entity.Entity.encode(message.entity, writer.uint32(10).fork()).ldelim();
    }
    if (message.signer !== "") {
      writer.uint32(18).string(message.signer);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseEntityUpdatedEvent();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.entity = _entity.Entity.decode(reader, reader.uint32());
          break;
        case 2:
          message.signer = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      entity: (0, _helpers.isSet)(object.entity) ? _entity.Entity.fromJSON(object.entity) : undefined,
      signer: (0, _helpers.isSet)(object.signer) ? String(object.signer) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.entity !== undefined && (obj.entity = message.entity ? _entity.Entity.toJSON(message.entity) : undefined);
    message.signer !== undefined && (obj.signer = message.signer);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$signer2;
    var message = createBaseEntityUpdatedEvent();
    message.entity = object.entity !== undefined && object.entity !== null ? _entity.Entity.fromPartial(object.entity) : undefined;
    message.signer = (_object$signer2 = object.signer) !== null && _object$signer2 !== void 0 ? _object$signer2 : "";
    return message;
  }
};
function createBaseEntityVerifiedUpdatedEvent() {
  return {
    id: "",
    signer: "",
    entityVerified: false
  };
}
var EntityVerifiedUpdatedEvent = exports.EntityVerifiedUpdatedEvent = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.signer !== "") {
      writer.uint32(18).string(message.signer);
    }
    if (message.entityVerified === true) {
      writer.uint32(24).bool(message.entityVerified);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseEntityVerifiedUpdatedEvent();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.signer = reader.string();
          break;
        case 3:
          message.entityVerified = reader.bool();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? String(object.id) : "",
      signer: (0, _helpers.isSet)(object.signer) ? String(object.signer) : "",
      entityVerified: (0, _helpers.isSet)(object.entityVerified) ? Boolean(object.entityVerified) : false
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.signer !== undefined && (obj.signer = message.signer);
    message.entityVerified !== undefined && (obj.entityVerified = message.entityVerified);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$id, _object$signer3, _object$entityVerifie;
    var message = createBaseEntityVerifiedUpdatedEvent();
    message.id = (_object$id = object.id) !== null && _object$id !== void 0 ? _object$id : "";
    message.signer = (_object$signer3 = object.signer) !== null && _object$signer3 !== void 0 ? _object$signer3 : "";
    message.entityVerified = (_object$entityVerifie = object.entityVerified) !== null && _object$entityVerifie !== void 0 ? _object$entityVerifie : false;
    return message;
  }
};
function createBaseEntityTransferredEvent() {
  return {
    id: "",
    from: "",
    to: ""
  };
}
var EntityTransferredEvent = exports.EntityTransferredEvent = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.from !== "") {
      writer.uint32(18).string(message.from);
    }
    if (message.to !== "") {
      writer.uint32(26).string(message.to);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseEntityTransferredEvent();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.from = reader.string();
          break;
        case 3:
          message.to = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? String(object.id) : "",
      from: (0, _helpers.isSet)(object.from) ? String(object.from) : "",
      to: (0, _helpers.isSet)(object.to) ? String(object.to) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.from !== undefined && (obj.from = message.from);
    message.to !== undefined && (obj.to = message.to);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$id2, _object$from, _object$to;
    var message = createBaseEntityTransferredEvent();
    message.id = (_object$id2 = object.id) !== null && _object$id2 !== void 0 ? _object$id2 : "";
    message.from = (_object$from = object.from) !== null && _object$from !== void 0 ? _object$from : "";
    message.to = (_object$to = object.to) !== null && _object$to !== void 0 ? _object$to : "";
    return message;
  }
};
function createBaseEntityAccountCreatedEvent() {
  return {
    id: "",
    signer: "",
    accountName: "",
    accountAddress: ""
  };
}
var EntityAccountCreatedEvent = exports.EntityAccountCreatedEvent = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.signer !== "") {
      writer.uint32(18).string(message.signer);
    }
    if (message.accountName !== "") {
      writer.uint32(26).string(message.accountName);
    }
    if (message.accountAddress !== "") {
      writer.uint32(34).string(message.accountAddress);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseEntityAccountCreatedEvent();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.signer = reader.string();
          break;
        case 3:
          message.accountName = reader.string();
          break;
        case 4:
          message.accountAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? String(object.id) : "",
      signer: (0, _helpers.isSet)(object.signer) ? String(object.signer) : "",
      accountName: (0, _helpers.isSet)(object.accountName) ? String(object.accountName) : "",
      accountAddress: (0, _helpers.isSet)(object.accountAddress) ? String(object.accountAddress) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.signer !== undefined && (obj.signer = message.signer);
    message.accountName !== undefined && (obj.accountName = message.accountName);
    message.accountAddress !== undefined && (obj.accountAddress = message.accountAddress);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$id3, _object$signer4, _object$accountName, _object$accountAddres;
    var message = createBaseEntityAccountCreatedEvent();
    message.id = (_object$id3 = object.id) !== null && _object$id3 !== void 0 ? _object$id3 : "";
    message.signer = (_object$signer4 = object.signer) !== null && _object$signer4 !== void 0 ? _object$signer4 : "";
    message.accountName = (_object$accountName = object.accountName) !== null && _object$accountName !== void 0 ? _object$accountName : "";
    message.accountAddress = (_object$accountAddres = object.accountAddress) !== null && _object$accountAddres !== void 0 ? _object$accountAddres : "";
    return message;
  }
};
function createBaseEntityAccountAuthzCreatedEvent() {
  return {
    id: "",
    signer: "",
    accountName: "",
    granter: "",
    grantee: "",
    grant: undefined
  };
}
var EntityAccountAuthzCreatedEvent = exports.EntityAccountAuthzCreatedEvent = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.signer !== "") {
      writer.uint32(18).string(message.signer);
    }
    if (message.accountName !== "") {
      writer.uint32(26).string(message.accountName);
    }
    if (message.granter !== "") {
      writer.uint32(34).string(message.granter);
    }
    if (message.grantee !== "") {
      writer.uint32(42).string(message.grantee);
    }
    if (message.grant !== undefined) {
      _authz.Grant.encode(message.grant, writer.uint32(50).fork()).ldelim();
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseEntityAccountAuthzCreatedEvent();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.signer = reader.string();
          break;
        case 3:
          message.accountName = reader.string();
          break;
        case 4:
          message.granter = reader.string();
          break;
        case 5:
          message.grantee = reader.string();
          break;
        case 6:
          message.grant = _authz.Grant.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? String(object.id) : "",
      signer: (0, _helpers.isSet)(object.signer) ? String(object.signer) : "",
      accountName: (0, _helpers.isSet)(object.accountName) ? String(object.accountName) : "",
      granter: (0, _helpers.isSet)(object.granter) ? String(object.granter) : "",
      grantee: (0, _helpers.isSet)(object.grantee) ? String(object.grantee) : "",
      grant: (0, _helpers.isSet)(object.grant) ? _authz.Grant.fromJSON(object.grant) : undefined
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.signer !== undefined && (obj.signer = message.signer);
    message.accountName !== undefined && (obj.accountName = message.accountName);
    message.granter !== undefined && (obj.granter = message.granter);
    message.grantee !== undefined && (obj.grantee = message.grantee);
    message.grant !== undefined && (obj.grant = message.grant ? _authz.Grant.toJSON(message.grant) : undefined);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$id4, _object$signer5, _object$accountName2, _object$granter, _object$grantee;
    var message = createBaseEntityAccountAuthzCreatedEvent();
    message.id = (_object$id4 = object.id) !== null && _object$id4 !== void 0 ? _object$id4 : "";
    message.signer = (_object$signer5 = object.signer) !== null && _object$signer5 !== void 0 ? _object$signer5 : "";
    message.accountName = (_object$accountName2 = object.accountName) !== null && _object$accountName2 !== void 0 ? _object$accountName2 : "";
    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.grant = object.grant !== undefined && object.grant !== null ? _authz.Grant.fromPartial(object.grant) : undefined;
    return message;
  }
};
function createBaseEntityAccountAuthzRevokedEvent() {
  return {
    id: "",
    signer: "",
    accountName: "",
    granter: "",
    grantee: "",
    msgTypeUrl: ""
  };
}
var EntityAccountAuthzRevokedEvent = exports.EntityAccountAuthzRevokedEvent = {
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _m0.Writer.create();
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.signer !== "") {
      writer.uint32(18).string(message.signer);
    }
    if (message.accountName !== "") {
      writer.uint32(26).string(message.accountName);
    }
    if (message.granter !== "") {
      writer.uint32(34).string(message.granter);
    }
    if (message.grantee !== "") {
      writer.uint32(42).string(message.grantee);
    }
    if (message.msgTypeUrl !== "") {
      writer.uint32(50).string(message.msgTypeUrl);
    }
    return writer;
  },
  decode: function decode(input, length) {
    var reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    var end = length === undefined ? reader.len : reader.pos + length;
    var message = createBaseEntityAccountAuthzRevokedEvent();
    while (reader.pos < end) {
      var tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.signer = reader.string();
          break;
        case 3:
          message.accountName = reader.string();
          break;
        case 4:
          message.granter = reader.string();
          break;
        case 5:
          message.grantee = reader.string();
          break;
        case 6:
          message.msgTypeUrl = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? String(object.id) : "",
      signer: (0, _helpers.isSet)(object.signer) ? String(object.signer) : "",
      accountName: (0, _helpers.isSet)(object.accountName) ? String(object.accountName) : "",
      granter: (0, _helpers.isSet)(object.granter) ? String(object.granter) : "",
      grantee: (0, _helpers.isSet)(object.grantee) ? String(object.grantee) : "",
      msgTypeUrl: (0, _helpers.isSet)(object.msgTypeUrl) ? String(object.msgTypeUrl) : ""
    };
  },
  toJSON: function toJSON(message) {
    var obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.signer !== undefined && (obj.signer = message.signer);
    message.accountName !== undefined && (obj.accountName = message.accountName);
    message.granter !== undefined && (obj.granter = message.granter);
    message.grantee !== undefined && (obj.grantee = message.grantee);
    message.msgTypeUrl !== undefined && (obj.msgTypeUrl = message.msgTypeUrl);
    return obj;
  },
  fromPartial: function fromPartial(object) {
    var _object$id5, _object$signer6, _object$accountName3, _object$granter2, _object$grantee2, _object$msgTypeUrl;
    var message = createBaseEntityAccountAuthzRevokedEvent();
    message.id = (_object$id5 = object.id) !== null && _object$id5 !== void 0 ? _object$id5 : "";
    message.signer = (_object$signer6 = object.signer) !== null && _object$signer6 !== void 0 ? _object$signer6 : "";
    message.accountName = (_object$accountName3 = object.accountName) !== null && _object$accountName3 !== void 0 ? _object$accountName3 : "";
    message.granter = (_object$granter2 = object.granter) !== null && _object$granter2 !== void 0 ? _object$granter2 : "";
    message.grantee = (_object$grantee2 = object.grantee) !== null && _object$grantee2 !== void 0 ? _object$grantee2 : "";
    message.msgTypeUrl = (_object$msgTypeUrl = object.msgTypeUrl) !== null && _object$msgTypeUrl !== void 0 ? _object$msgTypeUrl : "";
    return message;
  }
};