//@ts-nocheck
import { Entity } from "./entity";
import { Grant } from "../../../cosmos/authz/v1beta1/authz";
import * as _m0 from "protobufjs/minimal";
import { isSet } from "../../../helpers";
/** 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: ""
  };
}
export const EntityCreatedEvent = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.entity !== undefined) {
      Entity.encode(message.entity, writer.uint32(10).fork()).ldelim();
    }
    if (message.signer !== "") {
      writer.uint32(18).string(message.signer);
    }
    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 = createBaseEntityCreatedEvent();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.entity = Entity.decode(reader, reader.uint32());
          break;
        case 2:
          message.signer = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      entity: isSet(object.entity) ? Entity.fromJSON(object.entity) : undefined,
      signer: isSet(object.signer) ? String(object.signer) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.entity !== undefined && (obj.entity = message.entity ? Entity.toJSON(message.entity) : undefined);
    message.signer !== undefined && (obj.signer = message.signer);
    return obj;
  },
  fromPartial(object) {
    var _object$signer;
    const message = createBaseEntityCreatedEvent();
    message.entity = object.entity !== undefined && object.entity !== null ? 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: ""
  };
}
export const EntityUpdatedEvent = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.entity !== undefined) {
      Entity.encode(message.entity, writer.uint32(10).fork()).ldelim();
    }
    if (message.signer !== "") {
      writer.uint32(18).string(message.signer);
    }
    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 = createBaseEntityUpdatedEvent();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.entity = Entity.decode(reader, reader.uint32());
          break;
        case 2:
          message.signer = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      entity: isSet(object.entity) ? Entity.fromJSON(object.entity) : undefined,
      signer: isSet(object.signer) ? String(object.signer) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.entity !== undefined && (obj.entity = message.entity ? Entity.toJSON(message.entity) : undefined);
    message.signer !== undefined && (obj.signer = message.signer);
    return obj;
  },
  fromPartial(object) {
    var _object$signer2;
    const message = createBaseEntityUpdatedEvent();
    message.entity = object.entity !== undefined && object.entity !== null ? 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
  };
}
export const EntityVerifiedUpdatedEvent = {
  encode(message, writer = _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(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseEntityVerifiedUpdatedEvent();
    while (reader.pos < end) {
      const 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(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      signer: isSet(object.signer) ? String(object.signer) : "",
      entityVerified: isSet(object.entityVerified) ? Boolean(object.entityVerified) : false
    };
  },
  toJSON(message) {
    const 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(object) {
    var _object$id, _object$signer3, _object$entityVerifie;
    const 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: ""
  };
}
export const EntityTransferredEvent = {
  encode(message, writer = _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(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseEntityTransferredEvent();
    while (reader.pos < end) {
      const 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(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      from: isSet(object.from) ? String(object.from) : "",
      to: isSet(object.to) ? String(object.to) : ""
    };
  },
  toJSON(message) {
    const 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(object) {
    var _object$id2, _object$from, _object$to;
    const 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: ""
  };
}
export const EntityAccountCreatedEvent = {
  encode(message, writer = _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(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseEntityAccountCreatedEvent();
    while (reader.pos < end) {
      const 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(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      signer: isSet(object.signer) ? String(object.signer) : "",
      accountName: isSet(object.accountName) ? String(object.accountName) : "",
      accountAddress: isSet(object.accountAddress) ? String(object.accountAddress) : ""
    };
  },
  toJSON(message) {
    const 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(object) {
    var _object$id3, _object$signer4, _object$accountName, _object$accountAddres;
    const 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
  };
}
export const EntityAccountAuthzCreatedEvent = {
  encode(message, writer = _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) {
      Grant.encode(message.grant, writer.uint32(50).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 = createBaseEntityAccountAuthzCreatedEvent();
    while (reader.pos < end) {
      const 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 = Grant.decode(reader, reader.uint32());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      signer: isSet(object.signer) ? String(object.signer) : "",
      accountName: isSet(object.accountName) ? String(object.accountName) : "",
      granter: isSet(object.granter) ? String(object.granter) : "",
      grantee: isSet(object.grantee) ? String(object.grantee) : "",
      grant: isSet(object.grant) ? Grant.fromJSON(object.grant) : undefined
    };
  },
  toJSON(message) {
    const 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 ? Grant.toJSON(message.grant) : undefined);
    return obj;
  },
  fromPartial(object) {
    var _object$id4, _object$signer5, _object$accountName2, _object$granter, _object$grantee;
    const 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 ? Grant.fromPartial(object.grant) : undefined;
    return message;
  }
};
function createBaseEntityAccountAuthzRevokedEvent() {
  return {
    id: "",
    signer: "",
    accountName: "",
    granter: "",
    grantee: "",
    msgTypeUrl: ""
  };
}
export const EntityAccountAuthzRevokedEvent = {
  encode(message, writer = _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(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseEntityAccountAuthzRevokedEvent();
    while (reader.pos < end) {
      const 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(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      signer: isSet(object.signer) ? String(object.signer) : "",
      accountName: isSet(object.accountName) ? String(object.accountName) : "",
      granter: isSet(object.granter) ? String(object.granter) : "",
      grantee: isSet(object.grantee) ? String(object.grantee) : "",
      msgTypeUrl: isSet(object.msgTypeUrl) ? String(object.msgTypeUrl) : ""
    };
  },
  toJSON(message) {
    const 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(object) {
    var _object$id5, _object$signer6, _object$accountName3, _object$granter2, _object$grantee2, _object$msgTypeUrl;
    const 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;
  }
};