//@ts-nocheck
import { Timestamp } from "../../../google/protobuf/timestamp";
import * as _m0 from "protobufjs/minimal";
import { isSet, fromJsonTimestamp, fromTimestamp } from "../../../helpers";
function createBaseContext() {
  return {
    key: "",
    val: ""
  };
}
export const Context = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.key !== "") {
      writer.uint32(10).string(message.key);
    }
    if (message.val !== "") {
      writer.uint32(18).string(message.val);
    }
    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 = createBaseContext();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.key = reader.string();
          break;
        case 2:
          message.val = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      key: isSet(object.key) ? String(object.key) : "",
      val: isSet(object.val) ? String(object.val) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.key !== undefined && (obj.key = message.key);
    message.val !== undefined && (obj.val = message.val);
    return obj;
  },
  fromPartial(object) {
    var _object$key, _object$val;
    const message = createBaseContext();
    message.key = (_object$key = object.key) !== null && _object$key !== void 0 ? _object$key : "";
    message.val = (_object$val = object.val) !== null && _object$val !== void 0 ? _object$val : "";
    return message;
  }
};
function createBaseAccordedRight() {
  return {
    type: "",
    id: "",
    mechanism: "",
    message: "",
    service: ""
  };
}
export const AccordedRight = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.type !== "") {
      writer.uint32(10).string(message.type);
    }
    if (message.id !== "") {
      writer.uint32(18).string(message.id);
    }
    if (message.mechanism !== "") {
      writer.uint32(26).string(message.mechanism);
    }
    if (message.message !== "") {
      writer.uint32(34).string(message.message);
    }
    if (message.service !== "") {
      writer.uint32(42).string(message.service);
    }
    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 = createBaseAccordedRight();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.type = reader.string();
          break;
        case 2:
          message.id = reader.string();
          break;
        case 3:
          message.mechanism = reader.string();
          break;
        case 4:
          message.message = reader.string();
          break;
        case 5:
          message.service = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      type: isSet(object.type) ? String(object.type) : "",
      id: isSet(object.id) ? String(object.id) : "",
      mechanism: isSet(object.mechanism) ? String(object.mechanism) : "",
      message: isSet(object.message) ? String(object.message) : "",
      service: isSet(object.service) ? String(object.service) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.type !== undefined && (obj.type = message.type);
    message.id !== undefined && (obj.id = message.id);
    message.mechanism !== undefined && (obj.mechanism = message.mechanism);
    message.message !== undefined && (obj.message = message.message);
    message.service !== undefined && (obj.service = message.service);
    return obj;
  },
  fromPartial(object) {
    var _object$type, _object$id, _object$mechanism, _object$message, _object$service;
    const message = createBaseAccordedRight();
    message.type = (_object$type = object.type) !== null && _object$type !== void 0 ? _object$type : "";
    message.id = (_object$id = object.id) !== null && _object$id !== void 0 ? _object$id : "";
    message.mechanism = (_object$mechanism = object.mechanism) !== null && _object$mechanism !== void 0 ? _object$mechanism : "";
    message.message = (_object$message = object.message) !== null && _object$message !== void 0 ? _object$message : "";
    message.service = (_object$service = object.service) !== null && _object$service !== void 0 ? _object$service : "";
    return message;
  }
};
function createBaseLinkedResource() {
  return {
    type: "",
    id: "",
    description: "",
    mediaType: "",
    serviceEndpoint: "",
    proof: "",
    encrypted: "",
    right: ""
  };
}
export const LinkedResource = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.type !== "") {
      writer.uint32(10).string(message.type);
    }
    if (message.id !== "") {
      writer.uint32(18).string(message.id);
    }
    if (message.description !== "") {
      writer.uint32(26).string(message.description);
    }
    if (message.mediaType !== "") {
      writer.uint32(34).string(message.mediaType);
    }
    if (message.serviceEndpoint !== "") {
      writer.uint32(42).string(message.serviceEndpoint);
    }
    if (message.proof !== "") {
      writer.uint32(50).string(message.proof);
    }
    if (message.encrypted !== "") {
      writer.uint32(58).string(message.encrypted);
    }
    if (message.right !== "") {
      writer.uint32(66).string(message.right);
    }
    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 = createBaseLinkedResource();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.type = reader.string();
          break;
        case 2:
          message.id = reader.string();
          break;
        case 3:
          message.description = reader.string();
          break;
        case 4:
          message.mediaType = reader.string();
          break;
        case 5:
          message.serviceEndpoint = reader.string();
          break;
        case 6:
          message.proof = reader.string();
          break;
        case 7:
          message.encrypted = reader.string();
          break;
        case 8:
          message.right = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      type: isSet(object.type) ? String(object.type) : "",
      id: isSet(object.id) ? String(object.id) : "",
      description: isSet(object.description) ? String(object.description) : "",
      mediaType: isSet(object.mediaType) ? String(object.mediaType) : "",
      serviceEndpoint: isSet(object.serviceEndpoint) ? String(object.serviceEndpoint) : "",
      proof: isSet(object.proof) ? String(object.proof) : "",
      encrypted: isSet(object.encrypted) ? String(object.encrypted) : "",
      right: isSet(object.right) ? String(object.right) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.type !== undefined && (obj.type = message.type);
    message.id !== undefined && (obj.id = message.id);
    message.description !== undefined && (obj.description = message.description);
    message.mediaType !== undefined && (obj.mediaType = message.mediaType);
    message.serviceEndpoint !== undefined && (obj.serviceEndpoint = message.serviceEndpoint);
    message.proof !== undefined && (obj.proof = message.proof);
    message.encrypted !== undefined && (obj.encrypted = message.encrypted);
    message.right !== undefined && (obj.right = message.right);
    return obj;
  },
  fromPartial(object) {
    var _object$type2, _object$id2, _object$description, _object$mediaType, _object$serviceEndpoi, _object$proof, _object$encrypted, _object$right;
    const message = createBaseLinkedResource();
    message.type = (_object$type2 = object.type) !== null && _object$type2 !== void 0 ? _object$type2 : "";
    message.id = (_object$id2 = object.id) !== null && _object$id2 !== void 0 ? _object$id2 : "";
    message.description = (_object$description = object.description) !== null && _object$description !== void 0 ? _object$description : "";
    message.mediaType = (_object$mediaType = object.mediaType) !== null && _object$mediaType !== void 0 ? _object$mediaType : "";
    message.serviceEndpoint = (_object$serviceEndpoi = object.serviceEndpoint) !== null && _object$serviceEndpoi !== void 0 ? _object$serviceEndpoi : "";
    message.proof = (_object$proof = object.proof) !== null && _object$proof !== void 0 ? _object$proof : "";
    message.encrypted = (_object$encrypted = object.encrypted) !== null && _object$encrypted !== void 0 ? _object$encrypted : "";
    message.right = (_object$right = object.right) !== null && _object$right !== void 0 ? _object$right : "";
    return message;
  }
};
function createBaseLinkedClaim() {
  return {
    type: "",
    id: "",
    description: "",
    serviceEndpoint: "",
    proof: "",
    encrypted: "",
    right: ""
  };
}
export const LinkedClaim = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.type !== "") {
      writer.uint32(10).string(message.type);
    }
    if (message.id !== "") {
      writer.uint32(18).string(message.id);
    }
    if (message.description !== "") {
      writer.uint32(26).string(message.description);
    }
    if (message.serviceEndpoint !== "") {
      writer.uint32(34).string(message.serviceEndpoint);
    }
    if (message.proof !== "") {
      writer.uint32(42).string(message.proof);
    }
    if (message.encrypted !== "") {
      writer.uint32(50).string(message.encrypted);
    }
    if (message.right !== "") {
      writer.uint32(58).string(message.right);
    }
    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 = createBaseLinkedClaim();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.type = reader.string();
          break;
        case 2:
          message.id = reader.string();
          break;
        case 3:
          message.description = reader.string();
          break;
        case 4:
          message.serviceEndpoint = reader.string();
          break;
        case 5:
          message.proof = reader.string();
          break;
        case 6:
          message.encrypted = reader.string();
          break;
        case 7:
          message.right = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      type: isSet(object.type) ? String(object.type) : "",
      id: isSet(object.id) ? String(object.id) : "",
      description: isSet(object.description) ? String(object.description) : "",
      serviceEndpoint: isSet(object.serviceEndpoint) ? String(object.serviceEndpoint) : "",
      proof: isSet(object.proof) ? String(object.proof) : "",
      encrypted: isSet(object.encrypted) ? String(object.encrypted) : "",
      right: isSet(object.right) ? String(object.right) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.type !== undefined && (obj.type = message.type);
    message.id !== undefined && (obj.id = message.id);
    message.description !== undefined && (obj.description = message.description);
    message.serviceEndpoint !== undefined && (obj.serviceEndpoint = message.serviceEndpoint);
    message.proof !== undefined && (obj.proof = message.proof);
    message.encrypted !== undefined && (obj.encrypted = message.encrypted);
    message.right !== undefined && (obj.right = message.right);
    return obj;
  },
  fromPartial(object) {
    var _object$type3, _object$id3, _object$description2, _object$serviceEndpoi2, _object$proof2, _object$encrypted2, _object$right2;
    const message = createBaseLinkedClaim();
    message.type = (_object$type3 = object.type) !== null && _object$type3 !== void 0 ? _object$type3 : "";
    message.id = (_object$id3 = object.id) !== null && _object$id3 !== void 0 ? _object$id3 : "";
    message.description = (_object$description2 = object.description) !== null && _object$description2 !== void 0 ? _object$description2 : "";
    message.serviceEndpoint = (_object$serviceEndpoi2 = object.serviceEndpoint) !== null && _object$serviceEndpoi2 !== void 0 ? _object$serviceEndpoi2 : "";
    message.proof = (_object$proof2 = object.proof) !== null && _object$proof2 !== void 0 ? _object$proof2 : "";
    message.encrypted = (_object$encrypted2 = object.encrypted) !== null && _object$encrypted2 !== void 0 ? _object$encrypted2 : "";
    message.right = (_object$right2 = object.right) !== null && _object$right2 !== void 0 ? _object$right2 : "";
    return message;
  }
};
function createBaseLinkedEntity() {
  return {
    type: "",
    id: "",
    relationship: "",
    service: ""
  };
}
export const LinkedEntity = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.type !== "") {
      writer.uint32(10).string(message.type);
    }
    if (message.id !== "") {
      writer.uint32(18).string(message.id);
    }
    if (message.relationship !== "") {
      writer.uint32(26).string(message.relationship);
    }
    if (message.service !== "") {
      writer.uint32(34).string(message.service);
    }
    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 = createBaseLinkedEntity();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.type = reader.string();
          break;
        case 2:
          message.id = reader.string();
          break;
        case 3:
          message.relationship = reader.string();
          break;
        case 4:
          message.service = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      type: isSet(object.type) ? String(object.type) : "",
      id: isSet(object.id) ? String(object.id) : "",
      relationship: isSet(object.relationship) ? String(object.relationship) : "",
      service: isSet(object.service) ? String(object.service) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.type !== undefined && (obj.type = message.type);
    message.id !== undefined && (obj.id = message.id);
    message.relationship !== undefined && (obj.relationship = message.relationship);
    message.service !== undefined && (obj.service = message.service);
    return obj;
  },
  fromPartial(object) {
    var _object$type4, _object$id4, _object$relationship, _object$service2;
    const message = createBaseLinkedEntity();
    message.type = (_object$type4 = object.type) !== null && _object$type4 !== void 0 ? _object$type4 : "";
    message.id = (_object$id4 = object.id) !== null && _object$id4 !== void 0 ? _object$id4 : "";
    message.relationship = (_object$relationship = object.relationship) !== null && _object$relationship !== void 0 ? _object$relationship : "";
    message.service = (_object$service2 = object.service) !== null && _object$service2 !== void 0 ? _object$service2 : "";
    return message;
  }
};
function createBaseVerificationMethod() {
  return {
    id: "",
    type: "",
    controller: "",
    blockchainAccountID: undefined,
    publicKeyHex: undefined,
    publicKeyMultibase: undefined,
    publicKeyBase58: undefined
  };
}
export const VerificationMethod = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.type !== "") {
      writer.uint32(18).string(message.type);
    }
    if (message.controller !== "") {
      writer.uint32(26).string(message.controller);
    }
    if (message.blockchainAccountID !== undefined) {
      writer.uint32(34).string(message.blockchainAccountID);
    }
    if (message.publicKeyHex !== undefined) {
      writer.uint32(42).string(message.publicKeyHex);
    }
    if (message.publicKeyMultibase !== undefined) {
      writer.uint32(50).string(message.publicKeyMultibase);
    }
    if (message.publicKeyBase58 !== undefined) {
      writer.uint32(58).string(message.publicKeyBase58);
    }
    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 = createBaseVerificationMethod();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.type = reader.string();
          break;
        case 3:
          message.controller = reader.string();
          break;
        case 4:
          message.blockchainAccountID = reader.string();
          break;
        case 5:
          message.publicKeyHex = reader.string();
          break;
        case 6:
          message.publicKeyMultibase = reader.string();
          break;
        case 7:
          message.publicKeyBase58 = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      type: isSet(object.type) ? String(object.type) : "",
      controller: isSet(object.controller) ? String(object.controller) : "",
      blockchainAccountID: isSet(object.blockchainAccountID) ? String(object.blockchainAccountID) : undefined,
      publicKeyHex: isSet(object.publicKeyHex) ? String(object.publicKeyHex) : undefined,
      publicKeyMultibase: isSet(object.publicKeyMultibase) ? String(object.publicKeyMultibase) : undefined,
      publicKeyBase58: isSet(object.publicKeyBase58) ? String(object.publicKeyBase58) : undefined
    };
  },
  toJSON(message) {
    const obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.type !== undefined && (obj.type = message.type);
    message.controller !== undefined && (obj.controller = message.controller);
    message.blockchainAccountID !== undefined && (obj.blockchainAccountID = message.blockchainAccountID);
    message.publicKeyHex !== undefined && (obj.publicKeyHex = message.publicKeyHex);
    message.publicKeyMultibase !== undefined && (obj.publicKeyMultibase = message.publicKeyMultibase);
    message.publicKeyBase58 !== undefined && (obj.publicKeyBase58 = message.publicKeyBase58);
    return obj;
  },
  fromPartial(object) {
    var _object$id5, _object$type5, _object$controller, _object$blockchainAcc, _object$publicKeyHex, _object$publicKeyMult, _object$publicKeyBase;
    const message = createBaseVerificationMethod();
    message.id = (_object$id5 = object.id) !== null && _object$id5 !== void 0 ? _object$id5 : "";
    message.type = (_object$type5 = object.type) !== null && _object$type5 !== void 0 ? _object$type5 : "";
    message.controller = (_object$controller = object.controller) !== null && _object$controller !== void 0 ? _object$controller : "";
    message.blockchainAccountID = (_object$blockchainAcc = object.blockchainAccountID) !== null && _object$blockchainAcc !== void 0 ? _object$blockchainAcc : undefined;
    message.publicKeyHex = (_object$publicKeyHex = object.publicKeyHex) !== null && _object$publicKeyHex !== void 0 ? _object$publicKeyHex : undefined;
    message.publicKeyMultibase = (_object$publicKeyMult = object.publicKeyMultibase) !== null && _object$publicKeyMult !== void 0 ? _object$publicKeyMult : undefined;
    message.publicKeyBase58 = (_object$publicKeyBase = object.publicKeyBase58) !== null && _object$publicKeyBase !== void 0 ? _object$publicKeyBase : undefined;
    return message;
  }
};
function createBaseService() {
  return {
    id: "",
    type: "",
    serviceEndpoint: ""
  };
}
export const Service = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.type !== "") {
      writer.uint32(18).string(message.type);
    }
    if (message.serviceEndpoint !== "") {
      writer.uint32(26).string(message.serviceEndpoint);
    }
    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 = createBaseService();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.id = reader.string();
          break;
        case 2:
          message.type = reader.string();
          break;
        case 3:
          message.serviceEndpoint = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      id: isSet(object.id) ? String(object.id) : "",
      type: isSet(object.type) ? String(object.type) : "",
      serviceEndpoint: isSet(object.serviceEndpoint) ? String(object.serviceEndpoint) : ""
    };
  },
  toJSON(message) {
    const obj = {};
    message.id !== undefined && (obj.id = message.id);
    message.type !== undefined && (obj.type = message.type);
    message.serviceEndpoint !== undefined && (obj.serviceEndpoint = message.serviceEndpoint);
    return obj;
  },
  fromPartial(object) {
    var _object$id6, _object$type6, _object$serviceEndpoi3;
    const message = createBaseService();
    message.id = (_object$id6 = object.id) !== null && _object$id6 !== void 0 ? _object$id6 : "";
    message.type = (_object$type6 = object.type) !== null && _object$type6 !== void 0 ? _object$type6 : "";
    message.serviceEndpoint = (_object$serviceEndpoi3 = object.serviceEndpoint) !== null && _object$serviceEndpoi3 !== void 0 ? _object$serviceEndpoi3 : "";
    return message;
  }
};
function createBaseIidMetadata() {
  return {
    versionId: "",
    created: undefined,
    updated: undefined,
    deactivated: false
  };
}
export const IidMetadata = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.versionId !== "") {
      writer.uint32(10).string(message.versionId);
    }
    if (message.created !== undefined) {
      Timestamp.encode(message.created, writer.uint32(18).fork()).ldelim();
    }
    if (message.updated !== undefined) {
      Timestamp.encode(message.updated, writer.uint32(26).fork()).ldelim();
    }
    if (message.deactivated === true) {
      writer.uint32(32).bool(message.deactivated);
    }
    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 = createBaseIidMetadata();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.versionId = reader.string();
          break;
        case 2:
          message.created = Timestamp.decode(reader, reader.uint32());
          break;
        case 3:
          message.updated = Timestamp.decode(reader, reader.uint32());
          break;
        case 4:
          message.deactivated = reader.bool();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromJSON(object) {
    return {
      versionId: isSet(object.versionId) ? String(object.versionId) : "",
      created: isSet(object.created) ? fromJsonTimestamp(object.created) : undefined,
      updated: isSet(object.updated) ? fromJsonTimestamp(object.updated) : undefined,
      deactivated: isSet(object.deactivated) ? Boolean(object.deactivated) : false
    };
  },
  toJSON(message) {
    const obj = {};
    message.versionId !== undefined && (obj.versionId = message.versionId);
    message.created !== undefined && (obj.created = fromTimestamp(message.created).toISOString());
    message.updated !== undefined && (obj.updated = fromTimestamp(message.updated).toISOString());
    message.deactivated !== undefined && (obj.deactivated = message.deactivated);
    return obj;
  },
  fromPartial(object) {
    var _object$versionId, _object$deactivated;
    const message = createBaseIidMetadata();
    message.versionId = (_object$versionId = object.versionId) !== null && _object$versionId !== void 0 ? _object$versionId : "";
    message.created = object.created !== undefined && object.created !== null ? Timestamp.fromPartial(object.created) : undefined;
    message.updated = object.updated !== undefined && object.updated !== null ? Timestamp.fromPartial(object.updated) : undefined;
    message.deactivated = (_object$deactivated = object.deactivated) !== null && _object$deactivated !== void 0 ? _object$deactivated : false;
    return message;
  }
};