//@ts-nocheck
import { Context, Service, AccordedRight, LinkedResource, LinkedEntity, LinkedClaim } from "../../iid/v1beta1/types";
import { Verification } from "../../iid/v1beta1/tx";
import { Timestamp } from "../../../google/protobuf/timestamp";
import { Grant } from "../../../cosmos/authz/v1beta1/authz";
import * as _m0 from "protobufjs/minimal";
import { isSet, fromJsonTimestamp, bytesFromBase64, fromTimestamp, base64FromBytes } from "../../../helpers";

/**
 * Updates the entity with all the fields, so if field empty will be updated
 * with default go type, aka never null
 */

/**
 * Updates the entity with all the fields, so if field empty will be updated
 * with default go type, aka never null
 */

/** Only relayer nodes can update entity field 'entityVerified' */

/** Only relayer nodes can update entity field 'entityVerified' */

/** create a module account for an entity */

/** create a module account for an entity */

/**
 * Create a authz grant from entity account (as grantor) to recipient in msg as
 * grantee for the specific authorization
 */

/**
 * Create a authz grant from entity account (as grantor) to recipient in msg as
 * grantee for the specific authorization
 */

/** Revoke an existing authz grant from entity account (as grantor) to recipient */

/** Revoke an existing authz grant from entity account (as grantor) to recipient */

function createBaseMsgCreateEntity() {
  return {
    entityType: "",
    entityStatus: 0,
    controller: [],
    context: [],
    verification: [],
    service: [],
    accordedRight: [],
    linkedResource: [],
    linkedEntity: [],
    startDate: undefined,
    endDate: undefined,
    relayerNode: "",
    credentials: [],
    ownerDid: "",
    ownerAddress: "",
    data: new Uint8Array(),
    alsoKnownAs: "",
    linkedClaim: []
  };
}
export const MsgCreateEntity = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.entityType !== "") {
      writer.uint32(10).string(message.entityType);
    }
    if (message.entityStatus !== 0) {
      writer.uint32(16).int32(message.entityStatus);
    }
    for (const v of message.controller) {
      writer.uint32(26).string(v);
    }
    for (const v of message.context) {
      Context.encode(v, writer.uint32(34).fork()).ldelim();
    }
    for (const v of message.verification) {
      Verification.encode(v, writer.uint32(42).fork()).ldelim();
    }
    for (const v of message.service) {
      Service.encode(v, writer.uint32(50).fork()).ldelim();
    }
    for (const v of message.accordedRight) {
      AccordedRight.encode(v, writer.uint32(58).fork()).ldelim();
    }
    for (const v of message.linkedResource) {
      LinkedResource.encode(v, writer.uint32(66).fork()).ldelim();
    }
    for (const v of message.linkedEntity) {
      LinkedEntity.encode(v, writer.uint32(74).fork()).ldelim();
    }
    if (message.startDate !== undefined) {
      Timestamp.encode(message.startDate, writer.uint32(82).fork()).ldelim();
    }
    if (message.endDate !== undefined) {
      Timestamp.encode(message.endDate, writer.uint32(90).fork()).ldelim();
    }
    if (message.relayerNode !== "") {
      writer.uint32(98).string(message.relayerNode);
    }
    for (const v of message.credentials) {
      writer.uint32(106).string(v);
    }
    if (message.ownerDid !== "") {
      writer.uint32(114).string(message.ownerDid);
    }
    if (message.ownerAddress !== "") {
      writer.uint32(122).string(message.ownerAddress);
    }
    if (message.data.length !== 0) {
      writer.uint32(130).bytes(message.data);
    }
    if (message.alsoKnownAs !== "") {
      writer.uint32(138).string(message.alsoKnownAs);
    }
    for (const v of message.linkedClaim) {
      LinkedClaim.encode(v, writer.uint32(146).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 = createBaseMsgCreateEntity();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.entityType = reader.string();
          break;
        case 2:
          message.entityStatus = reader.int32();
          break;
        case 3:
          message.controller.push(reader.string());
          break;
        case 4:
          message.context.push(Context.decode(reader, reader.uint32()));
          break;
        case 5:
          message.verification.push(Verification.decode(reader, reader.uint32()));
          break;
        case 6:
          message.service.push(Service.decode(reader, reader.uint32()));
          break;
        case 7:
          message.accordedRight.push(AccordedRight.decode(reader, reader.uint32()));
          break;
        case 8:
          message.linkedResource.push(LinkedResource.decode(reader, reader.uint32()));
          break;
        case 9:
          message.linkedEntity.push(LinkedEntity.decode(reader, reader.uint32()));
          break;
        case 10:
          message.startDate = Timestamp.decode(reader, reader.uint32());
          break;
        case 11:
          message.endDate = Timestamp.decode(reader, reader.uint32());
          break;
        case 12:
          message.relayerNode = reader.string();
          break;
        case 13:
          message.credentials.push(reader.string());
          break;
        case 14:
          message.ownerDid = reader.string();
          break;
        case 15:
          message.ownerAddress = reader.string();
          break;
        case 16:
          message.data = reader.bytes();
          break;
        case 17:
          message.alsoKnownAs = reader.string();
          break;
        case 18:
          message.linkedClaim.push(LinkedClaim.decode(reader, reader.uint32()));
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      entityType: isSet(object.entityType) ? String(object.entityType) : "",
      entityStatus: isSet(object.entityStatus) ? Number(object.entityStatus) : 0,
      controller: Array.isArray(object === null || object === void 0 ? void 0 : object.controller) ? object.controller.map(e => String(e)) : [],
      context: Array.isArray(object === null || object === void 0 ? void 0 : object.context) ? object.context.map(e => Context.fromJSON(e)) : [],
      verification: Array.isArray(object === null || object === void 0 ? void 0 : object.verification) ? object.verification.map(e => Verification.fromJSON(e)) : [],
      service: Array.isArray(object === null || object === void 0 ? void 0 : object.service) ? object.service.map(e => Service.fromJSON(e)) : [],
      accordedRight: Array.isArray(object === null || object === void 0 ? void 0 : object.accordedRight) ? object.accordedRight.map(e => AccordedRight.fromJSON(e)) : [],
      linkedResource: Array.isArray(object === null || object === void 0 ? void 0 : object.linkedResource) ? object.linkedResource.map(e => LinkedResource.fromJSON(e)) : [],
      linkedEntity: Array.isArray(object === null || object === void 0 ? void 0 : object.linkedEntity) ? object.linkedEntity.map(e => LinkedEntity.fromJSON(e)) : [],
      startDate: isSet(object.startDate) ? fromJsonTimestamp(object.startDate) : undefined,
      endDate: isSet(object.endDate) ? fromJsonTimestamp(object.endDate) : undefined,
      relayerNode: isSet(object.relayerNode) ? String(object.relayerNode) : "",
      credentials: Array.isArray(object === null || object === void 0 ? void 0 : object.credentials) ? object.credentials.map(e => String(e)) : [],
      ownerDid: isSet(object.ownerDid) ? String(object.ownerDid) : "",
      ownerAddress: isSet(object.ownerAddress) ? String(object.ownerAddress) : "",
      data: isSet(object.data) ? bytesFromBase64(object.data) : new Uint8Array(),
      alsoKnownAs: isSet(object.alsoKnownAs) ? String(object.alsoKnownAs) : "",
      linkedClaim: Array.isArray(object === null || object === void 0 ? void 0 : object.linkedClaim) ? object.linkedClaim.map(e => LinkedClaim.fromJSON(e)) : []
    };
  },
  toJSON(message) {
    const obj = {};
    message.entityType !== undefined && (obj.entityType = message.entityType);
    message.entityStatus !== undefined && (obj.entityStatus = Math.round(message.entityStatus));
    if (message.controller) {
      obj.controller = message.controller.map(e => e);
    } else {
      obj.controller = [];
    }
    if (message.context) {
      obj.context = message.context.map(e => e ? Context.toJSON(e) : undefined);
    } else {
      obj.context = [];
    }
    if (message.verification) {
      obj.verification = message.verification.map(e => e ? Verification.toJSON(e) : undefined);
    } else {
      obj.verification = [];
    }
    if (message.service) {
      obj.service = message.service.map(e => e ? Service.toJSON(e) : undefined);
    } else {
      obj.service = [];
    }
    if (message.accordedRight) {
      obj.accordedRight = message.accordedRight.map(e => e ? AccordedRight.toJSON(e) : undefined);
    } else {
      obj.accordedRight = [];
    }
    if (message.linkedResource) {
      obj.linkedResource = message.linkedResource.map(e => e ? LinkedResource.toJSON(e) : undefined);
    } else {
      obj.linkedResource = [];
    }
    if (message.linkedEntity) {
      obj.linkedEntity = message.linkedEntity.map(e => e ? LinkedEntity.toJSON(e) : undefined);
    } else {
      obj.linkedEntity = [];
    }
    message.startDate !== undefined && (obj.startDate = fromTimestamp(message.startDate).toISOString());
    message.endDate !== undefined && (obj.endDate = fromTimestamp(message.endDate).toISOString());
    message.relayerNode !== undefined && (obj.relayerNode = message.relayerNode);
    if (message.credentials) {
      obj.credentials = message.credentials.map(e => e);
    } else {
      obj.credentials = [];
    }
    message.ownerDid !== undefined && (obj.ownerDid = message.ownerDid);
    message.ownerAddress !== undefined && (obj.ownerAddress = message.ownerAddress);
    message.data !== undefined && (obj.data = base64FromBytes(message.data !== undefined ? message.data : new Uint8Array()));
    message.alsoKnownAs !== undefined && (obj.alsoKnownAs = message.alsoKnownAs);
    if (message.linkedClaim) {
      obj.linkedClaim = message.linkedClaim.map(e => e ? LinkedClaim.toJSON(e) : undefined);
    } else {
      obj.linkedClaim = [];
    }
    return obj;
  },
  fromPartial(object) {
    var _object$entityType, _object$entityStatus, _object$controller, _object$context, _object$verification, _object$service, _object$accordedRight, _object$linkedResourc, _object$linkedEntity, _object$relayerNode, _object$credentials, _object$ownerDid, _object$ownerAddress, _object$data, _object$alsoKnownAs, _object$linkedClaim;
    const message = createBaseMsgCreateEntity();
    message.entityType = (_object$entityType = object.entityType) !== null && _object$entityType !== void 0 ? _object$entityType : "";
    message.entityStatus = (_object$entityStatus = object.entityStatus) !== null && _object$entityStatus !== void 0 ? _object$entityStatus : 0;
    message.controller = ((_object$controller = object.controller) === null || _object$controller === void 0 ? void 0 : _object$controller.map(e => e)) || [];
    message.context = ((_object$context = object.context) === null || _object$context === void 0 ? void 0 : _object$context.map(e => Context.fromPartial(e))) || [];
    message.verification = ((_object$verification = object.verification) === null || _object$verification === void 0 ? void 0 : _object$verification.map(e => Verification.fromPartial(e))) || [];
    message.service = ((_object$service = object.service) === null || _object$service === void 0 ? void 0 : _object$service.map(e => Service.fromPartial(e))) || [];
    message.accordedRight = ((_object$accordedRight = object.accordedRight) === null || _object$accordedRight === void 0 ? void 0 : _object$accordedRight.map(e => AccordedRight.fromPartial(e))) || [];
    message.linkedResource = ((_object$linkedResourc = object.linkedResource) === null || _object$linkedResourc === void 0 ? void 0 : _object$linkedResourc.map(e => LinkedResource.fromPartial(e))) || [];
    message.linkedEntity = ((_object$linkedEntity = object.linkedEntity) === null || _object$linkedEntity === void 0 ? void 0 : _object$linkedEntity.map(e => LinkedEntity.fromPartial(e))) || [];
    message.startDate = object.startDate !== undefined && object.startDate !== null ? Timestamp.fromPartial(object.startDate) : undefined;
    message.endDate = object.endDate !== undefined && object.endDate !== null ? Timestamp.fromPartial(object.endDate) : undefined;
    message.relayerNode = (_object$relayerNode = object.relayerNode) !== null && _object$relayerNode !== void 0 ? _object$relayerNode : "";
    message.credentials = ((_object$credentials = object.credentials) === null || _object$credentials === void 0 ? void 0 : _object$credentials.map(e => e)) || [];
    message.ownerDid = (_object$ownerDid = object.ownerDid) !== null && _object$ownerDid !== void 0 ? _object$ownerDid : "";
    message.ownerAddress = (_object$ownerAddress = object.ownerAddress) !== null && _object$ownerAddress !== void 0 ? _object$ownerAddress : "";
    message.data = (_object$data = object.data) !== null && _object$data !== void 0 ? _object$data : new Uint8Array();
    message.alsoKnownAs = (_object$alsoKnownAs = object.alsoKnownAs) !== null && _object$alsoKnownAs !== void 0 ? _object$alsoKnownAs : "";
    message.linkedClaim = ((_object$linkedClaim = object.linkedClaim) === null || _object$linkedClaim === void 0 ? void 0 : _object$linkedClaim.map(e => LinkedClaim.fromPartial(e))) || [];
    return message;
  }
};
function createBaseMsgCreateEntityResponse() {
  return {
    entityId: "",
    entityType: "",
    entityStatus: 0
  };
}
export const MsgCreateEntityResponse = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.entityId !== "") {
      writer.uint32(10).string(message.entityId);
    }
    if (message.entityType !== "") {
      writer.uint32(18).string(message.entityType);
    }
    if (message.entityStatus !== 0) {
      writer.uint32(24).int32(message.entityStatus);
    }
    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 = createBaseMsgCreateEntityResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.entityId = reader.string();
          break;
        case 2:
          message.entityType = reader.string();
          break;
        case 3:
          message.entityStatus = reader.int32();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      entityId: isSet(object.entityId) ? String(object.entityId) : "",
      entityType: isSet(object.entityType) ? String(object.entityType) : "",
      entityStatus: isSet(object.entityStatus) ? Number(object.entityStatus) : 0
    };
  },
  toJSON(message) {
    const obj = {};
    message.entityId !== undefined && (obj.entityId = message.entityId);
    message.entityType !== undefined && (obj.entityType = message.entityType);
    message.entityStatus !== undefined && (obj.entityStatus = Math.round(message.entityStatus));
    return obj;
  },
  fromPartial(object) {
    var _object$entityId, _object$entityType2, _object$entityStatus2;
    const message = createBaseMsgCreateEntityResponse();
    message.entityId = (_object$entityId = object.entityId) !== null && _object$entityId !== void 0 ? _object$entityId : "";
    message.entityType = (_object$entityType2 = object.entityType) !== null && _object$entityType2 !== void 0 ? _object$entityType2 : "";
    message.entityStatus = (_object$entityStatus2 = object.entityStatus) !== null && _object$entityStatus2 !== void 0 ? _object$entityStatus2 : 0;
    return message;
  }
};
function createBaseMsgUpdateEntity() {
  return {
    id: "",
    entityStatus: 0,
    startDate: undefined,
    endDate: undefined,
    credentials: [],
    controllerDid: "",
    controllerAddress: ""
  };
}
export const MsgUpdateEntity = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.entityStatus !== 0) {
      writer.uint32(16).int32(message.entityStatus);
    }
    if (message.startDate !== undefined) {
      Timestamp.encode(message.startDate, writer.uint32(26).fork()).ldelim();
    }
    if (message.endDate !== undefined) {
      Timestamp.encode(message.endDate, writer.uint32(34).fork()).ldelim();
    }
    for (const v of message.credentials) {
      writer.uint32(42).string(v);
    }
    if (message.controllerDid !== "") {
      writer.uint32(50).string(message.controllerDid);
    }
    if (message.controllerAddress !== "") {
      writer.uint32(58).string(message.controllerAddress);
    }
    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 = createBaseMsgUpdateEntity();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.entityStatus = reader.int32();
          break;
        case 3:
          message.startDate = Timestamp.decode(reader, reader.uint32());
          break;
        case 4:
          message.endDate = Timestamp.decode(reader, reader.uint32());
          break;
        case 5:
          message.credentials.push(reader.string());
          break;
        case 6:
          message.controllerDid = reader.string();
          break;
        case 7:
          message.controllerAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      entityStatus: isSet(object.entityStatus) ? Number(object.entityStatus) : 0,
      startDate: isSet(object.startDate) ? fromJsonTimestamp(object.startDate) : undefined,
      endDate: isSet(object.endDate) ? fromJsonTimestamp(object.endDate) : undefined,
      credentials: Array.isArray(object === null || object === void 0 ? void 0 : object.credentials) ? object.credentials.map(e => String(e)) : [],
      controllerDid: isSet(object.controllerDid) ? String(object.controllerDid) : "",
      controllerAddress: isSet(object.controllerAddress) ? String(object.controllerAddress) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.entityStatus !== undefined && (obj.entityStatus = Math.round(message.entityStatus));
    message.startDate !== undefined && (obj.startDate = fromTimestamp(message.startDate).toISOString());
    message.endDate !== undefined && (obj.endDate = fromTimestamp(message.endDate).toISOString());
    if (message.credentials) {
      obj.credentials = message.credentials.map(e => e);
    } else {
      obj.credentials = [];
    }
    message.controllerDid !== undefined && (obj.controllerDid = message.controllerDid);
    message.controllerAddress !== undefined && (obj.controllerAddress = message.controllerAddress);
    return obj;
  },
  fromPartial(object) {
    var _object$id, _object$entityStatus3, _object$credentials2, _object$controllerDid, _object$controllerAdd;
    const message = createBaseMsgUpdateEntity();
    message.id = (_object$id = object.id) !== null && _object$id !== void 0 ? _object$id : "";
    message.entityStatus = (_object$entityStatus3 = object.entityStatus) !== null && _object$entityStatus3 !== void 0 ? _object$entityStatus3 : 0;
    message.startDate = object.startDate !== undefined && object.startDate !== null ? Timestamp.fromPartial(object.startDate) : undefined;
    message.endDate = object.endDate !== undefined && object.endDate !== null ? Timestamp.fromPartial(object.endDate) : undefined;
    message.credentials = ((_object$credentials2 = object.credentials) === null || _object$credentials2 === void 0 ? void 0 : _object$credentials2.map(e => e)) || [];
    message.controllerDid = (_object$controllerDid = object.controllerDid) !== null && _object$controllerDid !== void 0 ? _object$controllerDid : "";
    message.controllerAddress = (_object$controllerAdd = object.controllerAddress) !== null && _object$controllerAdd !== void 0 ? _object$controllerAdd : "";
    return message;
  }
};
function createBaseMsgUpdateEntityResponse() {
  return {};
}
export const MsgUpdateEntityResponse = {
  encode(_, writer = _m0.Writer.create()) {
    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 = createBaseMsgUpdateEntityResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(_) {
    return {};
  },
  toJSON(_) {
    const obj = {};
    return obj;
  },
  fromPartial(_) {
    const message = createBaseMsgUpdateEntityResponse();
    return message;
  }
};
function createBaseMsgUpdateEntityVerified() {
  return {
    id: "",
    entityVerified: false,
    relayerNodeDid: "",
    relayerNodeAddress: ""
  };
}
export const MsgUpdateEntityVerified = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.entityVerified === true) {
      writer.uint32(16).bool(message.entityVerified);
    }
    if (message.relayerNodeDid !== "") {
      writer.uint32(26).string(message.relayerNodeDid);
    }
    if (message.relayerNodeAddress !== "") {
      writer.uint32(34).string(message.relayerNodeAddress);
    }
    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 = createBaseMsgUpdateEntityVerified();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.entityVerified = reader.bool();
          break;
        case 3:
          message.relayerNodeDid = reader.string();
          break;
        case 4:
          message.relayerNodeAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      entityVerified: isSet(object.entityVerified) ? Boolean(object.entityVerified) : false,
      relayerNodeDid: isSet(object.relayerNodeDid) ? String(object.relayerNodeDid) : "",
      relayerNodeAddress: isSet(object.relayerNodeAddress) ? String(object.relayerNodeAddress) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.entityVerified !== undefined && (obj.entityVerified = message.entityVerified);
    message.relayerNodeDid !== undefined && (obj.relayerNodeDid = message.relayerNodeDid);
    message.relayerNodeAddress !== undefined && (obj.relayerNodeAddress = message.relayerNodeAddress);
    return obj;
  },
  fromPartial(object) {
    var _object$id2, _object$entityVerifie, _object$relayerNodeDi, _object$relayerNodeAd;
    const message = createBaseMsgUpdateEntityVerified();
    message.id = (_object$id2 = object.id) !== null && _object$id2 !== void 0 ? _object$id2 : "";
    message.entityVerified = (_object$entityVerifie = object.entityVerified) !== null && _object$entityVerifie !== void 0 ? _object$entityVerifie : false;
    message.relayerNodeDid = (_object$relayerNodeDi = object.relayerNodeDid) !== null && _object$relayerNodeDi !== void 0 ? _object$relayerNodeDi : "";
    message.relayerNodeAddress = (_object$relayerNodeAd = object.relayerNodeAddress) !== null && _object$relayerNodeAd !== void 0 ? _object$relayerNodeAd : "";
    return message;
  }
};
function createBaseMsgUpdateEntityVerifiedResponse() {
  return {};
}
export const MsgUpdateEntityVerifiedResponse = {
  encode(_, writer = _m0.Writer.create()) {
    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 = createBaseMsgUpdateEntityVerifiedResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(_) {
    return {};
  },
  toJSON(_) {
    const obj = {};
    return obj;
  },
  fromPartial(_) {
    const message = createBaseMsgUpdateEntityVerifiedResponse();
    return message;
  }
};
function createBaseMsgTransferEntity() {
  return {
    id: "",
    ownerDid: "",
    ownerAddress: "",
    recipientDid: ""
  };
}
export const MsgTransferEntity = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.ownerDid !== "") {
      writer.uint32(18).string(message.ownerDid);
    }
    if (message.ownerAddress !== "") {
      writer.uint32(26).string(message.ownerAddress);
    }
    if (message.recipientDid !== "") {
      writer.uint32(34).string(message.recipientDid);
    }
    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 = createBaseMsgTransferEntity();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.ownerDid = reader.string();
          break;
        case 3:
          message.ownerAddress = reader.string();
          break;
        case 4:
          message.recipientDid = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      ownerDid: isSet(object.ownerDid) ? String(object.ownerDid) : "",
      ownerAddress: isSet(object.ownerAddress) ? String(object.ownerAddress) : "",
      recipientDid: isSet(object.recipientDid) ? String(object.recipientDid) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.ownerDid !== undefined && (obj.ownerDid = message.ownerDid);
    message.ownerAddress !== undefined && (obj.ownerAddress = message.ownerAddress);
    message.recipientDid !== undefined && (obj.recipientDid = message.recipientDid);
    return obj;
  },
  fromPartial(object) {
    var _object$id3, _object$ownerDid2, _object$ownerAddress2, _object$recipientDid;
    const message = createBaseMsgTransferEntity();
    message.id = (_object$id3 = object.id) !== null && _object$id3 !== void 0 ? _object$id3 : "";
    message.ownerDid = (_object$ownerDid2 = object.ownerDid) !== null && _object$ownerDid2 !== void 0 ? _object$ownerDid2 : "";
    message.ownerAddress = (_object$ownerAddress2 = object.ownerAddress) !== null && _object$ownerAddress2 !== void 0 ? _object$ownerAddress2 : "";
    message.recipientDid = (_object$recipientDid = object.recipientDid) !== null && _object$recipientDid !== void 0 ? _object$recipientDid : "";
    return message;
  }
};
function createBaseMsgTransferEntityResponse() {
  return {};
}
export const MsgTransferEntityResponse = {
  encode(_, writer = _m0.Writer.create()) {
    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 = createBaseMsgTransferEntityResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(_) {
    return {};
  },
  toJSON(_) {
    const obj = {};
    return obj;
  },
  fromPartial(_) {
    const message = createBaseMsgTransferEntityResponse();
    return message;
  }
};
function createBaseMsgCreateEntityAccount() {
  return {
    id: "",
    name: "",
    ownerAddress: ""
  };
}
export const MsgCreateEntityAccount = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.name !== "") {
      writer.uint32(18).string(message.name);
    }
    if (message.ownerAddress !== "") {
      writer.uint32(26).string(message.ownerAddress);
    }
    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 = createBaseMsgCreateEntityAccount();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.name = reader.string();
          break;
        case 3:
          message.ownerAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      name: isSet(object.name) ? String(object.name) : "",
      ownerAddress: isSet(object.ownerAddress) ? String(object.ownerAddress) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.name !== undefined && (obj.name = message.name);
    message.ownerAddress !== undefined && (obj.ownerAddress = message.ownerAddress);
    return obj;
  },
  fromPartial(object) {
    var _object$id4, _object$name, _object$ownerAddress3;
    const message = createBaseMsgCreateEntityAccount();
    message.id = (_object$id4 = object.id) !== null && _object$id4 !== void 0 ? _object$id4 : "";
    message.name = (_object$name = object.name) !== null && _object$name !== void 0 ? _object$name : "";
    message.ownerAddress = (_object$ownerAddress3 = object.ownerAddress) !== null && _object$ownerAddress3 !== void 0 ? _object$ownerAddress3 : "";
    return message;
  }
};
function createBaseMsgCreateEntityAccountResponse() {
  return {
    account: ""
  };
}
export const MsgCreateEntityAccountResponse = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.account !== "") {
      writer.uint32(10).string(message.account);
    }
    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 = createBaseMsgCreateEntityAccountResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.account = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      account: isSet(object.account) ? String(object.account) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.account !== undefined && (obj.account = message.account);
    return obj;
  },
  fromPartial(object) {
    var _object$account;
    const message = createBaseMsgCreateEntityAccountResponse();
    message.account = (_object$account = object.account) !== null && _object$account !== void 0 ? _object$account : "";
    return message;
  }
};
function createBaseMsgGrantEntityAccountAuthz() {
  return {
    id: "",
    name: "",
    granteeAddress: "",
    grant: undefined,
    ownerAddress: ""
  };
}
export const MsgGrantEntityAccountAuthz = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.name !== "") {
      writer.uint32(18).string(message.name);
    }
    if (message.granteeAddress !== "") {
      writer.uint32(26).string(message.granteeAddress);
    }
    if (message.grant !== undefined) {
      Grant.encode(message.grant, writer.uint32(34).fork()).ldelim();
    }
    if (message.ownerAddress !== "") {
      writer.uint32(42).string(message.ownerAddress);
    }
    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 = createBaseMsgGrantEntityAccountAuthz();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.name = reader.string();
          break;
        case 3:
          message.granteeAddress = reader.string();
          break;
        case 4:
          message.grant = Grant.decode(reader, reader.uint32());
          break;
        case 5:
          message.ownerAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      name: isSet(object.name) ? String(object.name) : "",
      granteeAddress: isSet(object.granteeAddress) ? String(object.granteeAddress) : "",
      grant: isSet(object.grant) ? Grant.fromJSON(object.grant) : undefined,
      ownerAddress: isSet(object.ownerAddress) ? String(object.ownerAddress) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.name !== undefined && (obj.name = message.name);
    message.granteeAddress !== undefined && (obj.granteeAddress = message.granteeAddress);
    message.grant !== undefined && (obj.grant = message.grant ? Grant.toJSON(message.grant) : undefined);
    message.ownerAddress !== undefined && (obj.ownerAddress = message.ownerAddress);
    return obj;
  },
  fromPartial(object) {
    var _object$id5, _object$name2, _object$granteeAddres, _object$ownerAddress4;
    const message = createBaseMsgGrantEntityAccountAuthz();
    message.id = (_object$id5 = object.id) !== null && _object$id5 !== void 0 ? _object$id5 : "";
    message.name = (_object$name2 = object.name) !== null && _object$name2 !== void 0 ? _object$name2 : "";
    message.granteeAddress = (_object$granteeAddres = object.granteeAddress) !== null && _object$granteeAddres !== void 0 ? _object$granteeAddres : "";
    message.grant = object.grant !== undefined && object.grant !== null ? Grant.fromPartial(object.grant) : undefined;
    message.ownerAddress = (_object$ownerAddress4 = object.ownerAddress) !== null && _object$ownerAddress4 !== void 0 ? _object$ownerAddress4 : "";
    return message;
  }
};
function createBaseMsgGrantEntityAccountAuthzResponse() {
  return {};
}
export const MsgGrantEntityAccountAuthzResponse = {
  encode(_, writer = _m0.Writer.create()) {
    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 = createBaseMsgGrantEntityAccountAuthzResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(_) {
    return {};
  },
  toJSON(_) {
    const obj = {};
    return obj;
  },
  fromPartial(_) {
    const message = createBaseMsgGrantEntityAccountAuthzResponse();
    return message;
  }
};
function createBaseMsgRevokeEntityAccountAuthz() {
  return {
    id: "",
    name: "",
    granteeAddress: "",
    msgTypeUrl: "",
    ownerAddress: ""
  };
}
export const MsgRevokeEntityAccountAuthz = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.name !== "") {
      writer.uint32(18).string(message.name);
    }
    if (message.granteeAddress !== "") {
      writer.uint32(26).string(message.granteeAddress);
    }
    if (message.msgTypeUrl !== "") {
      writer.uint32(34).string(message.msgTypeUrl);
    }
    if (message.ownerAddress !== "") {
      writer.uint32(42).string(message.ownerAddress);
    }
    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 = createBaseMsgRevokeEntityAccountAuthz();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.name = reader.string();
          break;
        case 3:
          message.granteeAddress = reader.string();
          break;
        case 4:
          message.msgTypeUrl = reader.string();
          break;
        case 5:
          message.ownerAddress = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      name: isSet(object.name) ? String(object.name) : "",
      granteeAddress: isSet(object.granteeAddress) ? String(object.granteeAddress) : "",
      msgTypeUrl: isSet(object.msgTypeUrl) ? String(object.msgTypeUrl) : "",
      ownerAddress: isSet(object.ownerAddress) ? String(object.ownerAddress) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.name !== undefined && (obj.name = message.name);
    message.granteeAddress !== undefined && (obj.granteeAddress = message.granteeAddress);
    message.msgTypeUrl !== undefined && (obj.msgTypeUrl = message.msgTypeUrl);
    message.ownerAddress !== undefined && (obj.ownerAddress = message.ownerAddress);
    return obj;
  },
  fromPartial(object) {
    var _object$id6, _object$name3, _object$granteeAddres2, _object$msgTypeUrl, _object$ownerAddress5;
    const message = createBaseMsgRevokeEntityAccountAuthz();
    message.id = (_object$id6 = object.id) !== null && _object$id6 !== void 0 ? _object$id6 : "";
    message.name = (_object$name3 = object.name) !== null && _object$name3 !== void 0 ? _object$name3 : "";
    message.granteeAddress = (_object$granteeAddres2 = object.granteeAddress) !== null && _object$granteeAddres2 !== void 0 ? _object$granteeAddres2 : "";
    message.msgTypeUrl = (_object$msgTypeUrl = object.msgTypeUrl) !== null && _object$msgTypeUrl !== void 0 ? _object$msgTypeUrl : "";
    message.ownerAddress = (_object$ownerAddress5 = object.ownerAddress) !== null && _object$ownerAddress5 !== void 0 ? _object$ownerAddress5 : "";
    return message;
  }
};
function createBaseMsgRevokeEntityAccountAuthzResponse() {
  return {};
}
export const MsgRevokeEntityAccountAuthzResponse = {
  encode(_, writer = _m0.Writer.create()) {
    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 = createBaseMsgRevokeEntityAccountAuthzResponse();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(_) {
    return {};
  },
  toJSON(_) {
    const obj = {};
    return obj;
  },
  fromPartial(_) {
    const message = createBaseMsgRevokeEntityAccountAuthzResponse();
    return message;
  }
};