"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.RepositoryRelease = exports.RepositoryOwner = exports.RepositoryLabel = exports.RepositoryId = exports.RepositoryCollaborator_PermissionSDKType = exports.RepositoryCollaborator_PermissionAmino = exports.RepositoryCollaborator_Permission = exports.RepositoryCollaborator = exports.RepositoryBackup_StoreSDKType = exports.RepositoryBackup_StoreAmino = exports.RepositoryBackup_Store = exports.RepositoryBackup = exports.Repository = exports.PullRequestIid = exports.IssueIid = exports.BaseRepositoryKey = void 0;
exports.repositoryBackup_StoreFromJSON = repositoryBackup_StoreFromJSON;
exports.repositoryBackup_StoreToJSON = repositoryBackup_StoreToJSON;
exports.repositoryCollaborator_PermissionFromJSON = repositoryCollaborator_PermissionFromJSON;
exports.repositoryCollaborator_PermissionToJSON = repositoryCollaborator_PermissionToJSON;
var _whois = require("./whois");
var _binary = require("../binary");
var _helpers = require("../helpers");
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
var RepositoryCollaborator_Permission = exports.RepositoryCollaborator_Permission = /*#__PURE__*/function (RepositoryCollaborator_Permission) {
  RepositoryCollaborator_Permission[RepositoryCollaborator_Permission["READ"] = 0] = "READ";
  RepositoryCollaborator_Permission[RepositoryCollaborator_Permission["TRIAGE"] = 1] = "TRIAGE";
  RepositoryCollaborator_Permission[RepositoryCollaborator_Permission["WRITE"] = 2] = "WRITE";
  RepositoryCollaborator_Permission[RepositoryCollaborator_Permission["MAINTAIN"] = 3] = "MAINTAIN";
  RepositoryCollaborator_Permission[RepositoryCollaborator_Permission["ADMIN"] = 4] = "ADMIN";
  RepositoryCollaborator_Permission[RepositoryCollaborator_Permission["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return RepositoryCollaborator_Permission;
}({});
var RepositoryCollaborator_PermissionSDKType = exports.RepositoryCollaborator_PermissionSDKType = RepositoryCollaborator_Permission;
var RepositoryCollaborator_PermissionAmino = exports.RepositoryCollaborator_PermissionAmino = RepositoryCollaborator_Permission;
function repositoryCollaborator_PermissionFromJSON(object) {
  switch (object) {
    case 0:
    case "READ":
      return RepositoryCollaborator_Permission.READ;
    case 1:
    case "TRIAGE":
      return RepositoryCollaborator_Permission.TRIAGE;
    case 2:
    case "WRITE":
      return RepositoryCollaborator_Permission.WRITE;
    case 3:
    case "MAINTAIN":
      return RepositoryCollaborator_Permission.MAINTAIN;
    case 4:
    case "ADMIN":
      return RepositoryCollaborator_Permission.ADMIN;
    case -1:
    case "UNRECOGNIZED":
    default:
      return RepositoryCollaborator_Permission.UNRECOGNIZED;
  }
}
function repositoryCollaborator_PermissionToJSON(object) {
  switch (object) {
    case RepositoryCollaborator_Permission.READ:
      return "READ";
    case RepositoryCollaborator_Permission.TRIAGE:
      return "TRIAGE";
    case RepositoryCollaborator_Permission.WRITE:
      return "WRITE";
    case RepositoryCollaborator_Permission.MAINTAIN:
      return "MAINTAIN";
    case RepositoryCollaborator_Permission.ADMIN:
      return "ADMIN";
    case RepositoryCollaborator_Permission.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
var RepositoryBackup_Store = exports.RepositoryBackup_Store = /*#__PURE__*/function (RepositoryBackup_Store) {
  RepositoryBackup_Store[RepositoryBackup_Store["IPFS"] = 0] = "IPFS";
  RepositoryBackup_Store[RepositoryBackup_Store["ARWEAVE"] = 1] = "ARWEAVE";
  RepositoryBackup_Store[RepositoryBackup_Store["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return RepositoryBackup_Store;
}({});
var RepositoryBackup_StoreSDKType = exports.RepositoryBackup_StoreSDKType = RepositoryBackup_Store;
var RepositoryBackup_StoreAmino = exports.RepositoryBackup_StoreAmino = RepositoryBackup_Store;
function repositoryBackup_StoreFromJSON(object) {
  switch (object) {
    case 0:
    case "IPFS":
      return RepositoryBackup_Store.IPFS;
    case 1:
    case "ARWEAVE":
      return RepositoryBackup_Store.ARWEAVE;
    case -1:
    case "UNRECOGNIZED":
    default:
      return RepositoryBackup_Store.UNRECOGNIZED;
  }
}
function repositoryBackup_StoreToJSON(object) {
  switch (object) {
    case RepositoryBackup_Store.IPFS:
      return "IPFS";
    case RepositoryBackup_Store.ARWEAVE:
      return "ARWEAVE";
    case RepositoryBackup_Store.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
function createBaseRepository() {
  return {
    creator: "",
    id: BigInt(0),
    name: "",
    owner: undefined,
    description: "",
    forks: [],
    subscribers: "",
    commits: "",
    issuesCount: BigInt(0),
    pullsCount: BigInt(0),
    labels: [],
    labelsCount: BigInt(0),
    releases: [],
    createdAt: BigInt(0),
    updatedAt: BigInt(0),
    pushedAt: BigInt(0),
    stargazers: [],
    archived: false,
    license: "",
    defaultBranch: "",
    parent: BigInt(0),
    fork: false,
    collaborators: [],
    allowForking: false,
    backups: [],
    enableArweaveBackup: false
  };
}
var Repository = exports.Repository = {
  typeUrl: "/gitopia.gitopia.gitopia.Repository",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.creator !== "") {
      writer.uint32(10).string(message.creator);
    }
    if (message.id !== BigInt(0)) {
      writer.uint32(16).uint64(message.id);
    }
    if (message.name !== "") {
      writer.uint32(26).string(message.name);
    }
    if (message.owner !== undefined) {
      RepositoryOwner.encode(message.owner, writer.uint32(34).fork()).ldelim();
    }
    if (message.description !== "") {
      writer.uint32(42).string(message.description);
    }
    writer.uint32(50).fork();
    var _iterator = _createForOfIteratorHelper(message.forks),
      _step;
    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var v = _step.value;
        writer.uint64(v);
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
    writer.ldelim();
    if (message.subscribers !== "") {
      writer.uint32(58).string(message.subscribers);
    }
    if (message.commits !== "") {
      writer.uint32(66).string(message.commits);
    }
    if (message.issuesCount !== BigInt(0)) {
      writer.uint32(72).uint64(message.issuesCount);
    }
    if (message.pullsCount !== BigInt(0)) {
      writer.uint32(80).uint64(message.pullsCount);
    }
    var _iterator2 = _createForOfIteratorHelper(message.labels),
      _step2;
    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var _v = _step2.value;
        RepositoryLabel.encode(_v, writer.uint32(90).fork()).ldelim();
      }
    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }
    if (message.labelsCount !== BigInt(0)) {
      writer.uint32(96).uint64(message.labelsCount);
    }
    var _iterator3 = _createForOfIteratorHelper(message.releases),
      _step3;
    try {
      for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
        var _v2 = _step3.value;
        RepositoryRelease.encode(_v2, writer.uint32(106).fork()).ldelim();
      }
    } catch (err) {
      _iterator3.e(err);
    } finally {
      _iterator3.f();
    }
    if (message.createdAt !== BigInt(0)) {
      writer.uint32(112).int64(message.createdAt);
    }
    if (message.updatedAt !== BigInt(0)) {
      writer.uint32(120).int64(message.updatedAt);
    }
    if (message.pushedAt !== BigInt(0)) {
      writer.uint32(128).int64(message.pushedAt);
    }
    writer.uint32(138).fork();
    var _iterator4 = _createForOfIteratorHelper(message.stargazers),
      _step4;
    try {
      for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
        var _v3 = _step4.value;
        writer.uint64(_v3);
      }
    } catch (err) {
      _iterator4.e(err);
    } finally {
      _iterator4.f();
    }
    writer.ldelim();
    if (message.archived === true) {
      writer.uint32(144).bool(message.archived);
    }
    if (message.license !== "") {
      writer.uint32(154).string(message.license);
    }
    if (message.defaultBranch !== "") {
      writer.uint32(162).string(message.defaultBranch);
    }
    if (message.parent !== BigInt(0)) {
      writer.uint32(168).uint64(message.parent);
    }
    if (message.fork === true) {
      writer.uint32(176).bool(message.fork);
    }
    var _iterator5 = _createForOfIteratorHelper(message.collaborators),
      _step5;
    try {
      for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
        var _v4 = _step5.value;
        RepositoryCollaborator.encode(_v4, writer.uint32(186).fork()).ldelim();
      }
    } catch (err) {
      _iterator5.e(err);
    } finally {
      _iterator5.f();
    }
    if (message.allowForking === true) {
      writer.uint32(192).bool(message.allowForking);
    }
    var _iterator6 = _createForOfIteratorHelper(message.backups),
      _step6;
    try {
      for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
        var _v5 = _step6.value;
        RepositoryBackup.encode(_v5, writer.uint32(202).fork()).ldelim();
      }
    } catch (err) {
      _iterator6.e(err);
    } finally {
      _iterator6.f();
    }
    if (message.enableArweaveBackup === true) {
      writer.uint32(208).bool(message.enableArweaveBackup);
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      creator: (0, _helpers.isSet)(object.creator) ? String(object.creator) : "",
      id: (0, _helpers.isSet)(object.id) ? BigInt(object.id.toString()) : BigInt(0),
      name: (0, _helpers.isSet)(object.name) ? String(object.name) : "",
      owner: (0, _helpers.isSet)(object.owner) ? RepositoryOwner.fromJSON(object.owner) : undefined,
      description: (0, _helpers.isSet)(object.description) ? String(object.description) : "",
      forks: Array.isArray(object === null || object === void 0 ? void 0 : object.forks) ? object.forks.map(function (e) {
        return BigInt(e.toString());
      }) : [],
      subscribers: (0, _helpers.isSet)(object.subscribers) ? String(object.subscribers) : "",
      commits: (0, _helpers.isSet)(object.commits) ? String(object.commits) : "",
      issuesCount: (0, _helpers.isSet)(object.issuesCount) ? BigInt(object.issuesCount.toString()) : BigInt(0),
      pullsCount: (0, _helpers.isSet)(object.pullsCount) ? BigInt(object.pullsCount.toString()) : BigInt(0),
      labels: Array.isArray(object === null || object === void 0 ? void 0 : object.labels) ? object.labels.map(function (e) {
        return RepositoryLabel.fromJSON(e);
      }) : [],
      labelsCount: (0, _helpers.isSet)(object.labelsCount) ? BigInt(object.labelsCount.toString()) : BigInt(0),
      releases: Array.isArray(object === null || object === void 0 ? void 0 : object.releases) ? object.releases.map(function (e) {
        return RepositoryRelease.fromJSON(e);
      }) : [],
      createdAt: (0, _helpers.isSet)(object.createdAt) ? BigInt(object.createdAt.toString()) : BigInt(0),
      updatedAt: (0, _helpers.isSet)(object.updatedAt) ? BigInt(object.updatedAt.toString()) : BigInt(0),
      pushedAt: (0, _helpers.isSet)(object.pushedAt) ? BigInt(object.pushedAt.toString()) : BigInt(0),
      stargazers: Array.isArray(object === null || object === void 0 ? void 0 : object.stargazers) ? object.stargazers.map(function (e) {
        return BigInt(e.toString());
      }) : [],
      archived: (0, _helpers.isSet)(object.archived) ? Boolean(object.archived) : false,
      license: (0, _helpers.isSet)(object.license) ? String(object.license) : "",
      defaultBranch: (0, _helpers.isSet)(object.defaultBranch) ? String(object.defaultBranch) : "",
      parent: (0, _helpers.isSet)(object.parent) ? BigInt(object.parent.toString()) : BigInt(0),
      fork: (0, _helpers.isSet)(object.fork) ? Boolean(object.fork) : false,
      collaborators: Array.isArray(object === null || object === void 0 ? void 0 : object.collaborators) ? object.collaborators.map(function (e) {
        return RepositoryCollaborator.fromJSON(e);
      }) : [],
      allowForking: (0, _helpers.isSet)(object.allowForking) ? Boolean(object.allowForking) : false,
      backups: Array.isArray(object === null || object === void 0 ? void 0 : object.backups) ? object.backups.map(function (e) {
        return RepositoryBackup.fromJSON(e);
      }) : [],
      enableArweaveBackup: (0, _helpers.isSet)(object.enableArweaveBackup) ? Boolean(object.enableArweaveBackup) : false
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$creator, _object$name, _object$description, _object$forks, _object$subscribers, _object$commits, _object$labels, _object$releases, _object$stargazers, _object$archived, _object$license, _object$defaultBranch, _object$fork, _object$collaborators, _object$allowForking, _object$backups, _object$enableArweave;
    var message = createBaseRepository();
    message.creator = (_object$creator = object.creator) !== null && _object$creator !== void 0 ? _object$creator : "";
    message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0);
    message.name = (_object$name = object.name) !== null && _object$name !== void 0 ? _object$name : "";
    message.owner = object.owner !== undefined && object.owner !== null ? RepositoryOwner.fromPartial(object.owner) : undefined;
    message.description = (_object$description = object.description) !== null && _object$description !== void 0 ? _object$description : "";
    message.forks = ((_object$forks = object.forks) === null || _object$forks === void 0 ? void 0 : _object$forks.map(function (e) {
      return BigInt(e.toString());
    })) || [];
    message.subscribers = (_object$subscribers = object.subscribers) !== null && _object$subscribers !== void 0 ? _object$subscribers : "";
    message.commits = (_object$commits = object.commits) !== null && _object$commits !== void 0 ? _object$commits : "";
    message.issuesCount = object.issuesCount !== undefined && object.issuesCount !== null ? BigInt(object.issuesCount.toString()) : BigInt(0);
    message.pullsCount = object.pullsCount !== undefined && object.pullsCount !== null ? BigInt(object.pullsCount.toString()) : BigInt(0);
    message.labels = ((_object$labels = object.labels) === null || _object$labels === void 0 ? void 0 : _object$labels.map(function (e) {
      return RepositoryLabel.fromPartial(e);
    })) || [];
    message.labelsCount = object.labelsCount !== undefined && object.labelsCount !== null ? BigInt(object.labelsCount.toString()) : BigInt(0);
    message.releases = ((_object$releases = object.releases) === null || _object$releases === void 0 ? void 0 : _object$releases.map(function (e) {
      return RepositoryRelease.fromPartial(e);
    })) || [];
    message.createdAt = object.createdAt !== undefined && object.createdAt !== null ? BigInt(object.createdAt.toString()) : BigInt(0);
    message.updatedAt = object.updatedAt !== undefined && object.updatedAt !== null ? BigInt(object.updatedAt.toString()) : BigInt(0);
    message.pushedAt = object.pushedAt !== undefined && object.pushedAt !== null ? BigInt(object.pushedAt.toString()) : BigInt(0);
    message.stargazers = ((_object$stargazers = object.stargazers) === null || _object$stargazers === void 0 ? void 0 : _object$stargazers.map(function (e) {
      return BigInt(e.toString());
    })) || [];
    message.archived = (_object$archived = object.archived) !== null && _object$archived !== void 0 ? _object$archived : false;
    message.license = (_object$license = object.license) !== null && _object$license !== void 0 ? _object$license : "";
    message.defaultBranch = (_object$defaultBranch = object.defaultBranch) !== null && _object$defaultBranch !== void 0 ? _object$defaultBranch : "";
    message.parent = object.parent !== undefined && object.parent !== null ? BigInt(object.parent.toString()) : BigInt(0);
    message.fork = (_object$fork = object.fork) !== null && _object$fork !== void 0 ? _object$fork : false;
    message.collaborators = ((_object$collaborators = object.collaborators) === null || _object$collaborators === void 0 ? void 0 : _object$collaborators.map(function (e) {
      return RepositoryCollaborator.fromPartial(e);
    })) || [];
    message.allowForking = (_object$allowForking = object.allowForking) !== null && _object$allowForking !== void 0 ? _object$allowForking : false;
    message.backups = ((_object$backups = object.backups) === null || _object$backups === void 0 ? void 0 : _object$backups.map(function (e) {
      return RepositoryBackup.fromPartial(e);
    })) || [];
    message.enableArweaveBackup = (_object$enableArweave = object.enableArweaveBackup) !== null && _object$enableArweave !== void 0 ? _object$enableArweave : false;
    return message;
  },
  fromAmino: function fromAmino(object) {
    var _object$forks2, _object$labels2, _object$releases2, _object$stargazers2, _object$collaborators2, _object$backups2;
    var message = createBaseRepository();
    if (object.creator !== undefined && object.creator !== null) {
      message.creator = object.creator;
    }
    if (object.id !== undefined && object.id !== null) {
      message.id = BigInt(object.id);
    }
    if (object.name !== undefined && object.name !== null) {
      message.name = object.name;
    }
    if (object.owner !== undefined && object.owner !== null) {
      message.owner = RepositoryOwner.fromAmino(object.owner);
    }
    if (object.description !== undefined && object.description !== null) {
      message.description = object.description;
    }
    message.forks = ((_object$forks2 = object.forks) === null || _object$forks2 === void 0 ? void 0 : _object$forks2.map(function (e) {
      return BigInt(e);
    })) || [];
    if (object.subscribers !== undefined && object.subscribers !== null) {
      message.subscribers = object.subscribers;
    }
    if (object.commits !== undefined && object.commits !== null) {
      message.commits = object.commits;
    }
    if (object.issuesCount !== undefined && object.issuesCount !== null) {
      message.issuesCount = BigInt(object.issuesCount);
    }
    if (object.pullsCount !== undefined && object.pullsCount !== null) {
      message.pullsCount = BigInt(object.pullsCount);
    }
    message.labels = ((_object$labels2 = object.labels) === null || _object$labels2 === void 0 ? void 0 : _object$labels2.map(function (e) {
      return RepositoryLabel.fromAmino(e);
    })) || [];
    if (object.labelsCount !== undefined && object.labelsCount !== null) {
      message.labelsCount = BigInt(object.labelsCount);
    }
    message.releases = ((_object$releases2 = object.releases) === null || _object$releases2 === void 0 ? void 0 : _object$releases2.map(function (e) {
      return RepositoryRelease.fromAmino(e);
    })) || [];
    if (object.createdAt !== undefined && object.createdAt !== null) {
      message.createdAt = BigInt(object.createdAt);
    }
    if (object.updatedAt !== undefined && object.updatedAt !== null) {
      message.updatedAt = BigInt(object.updatedAt);
    }
    if (object.pushedAt !== undefined && object.pushedAt !== null) {
      message.pushedAt = BigInt(object.pushedAt);
    }
    message.stargazers = ((_object$stargazers2 = object.stargazers) === null || _object$stargazers2 === void 0 ? void 0 : _object$stargazers2.map(function (e) {
      return BigInt(e);
    })) || [];
    if (object.archived !== undefined && object.archived !== null) {
      message.archived = object.archived;
    }
    if (object.license !== undefined && object.license !== null) {
      message.license = object.license;
    }
    if (object.defaultBranch !== undefined && object.defaultBranch !== null) {
      message.defaultBranch = object.defaultBranch;
    }
    if (object.parent !== undefined && object.parent !== null) {
      message.parent = BigInt(object.parent);
    }
    if (object.fork !== undefined && object.fork !== null) {
      message.fork = object.fork;
    }
    message.collaborators = ((_object$collaborators2 = object.collaborators) === null || _object$collaborators2 === void 0 ? void 0 : _object$collaborators2.map(function (e) {
      return RepositoryCollaborator.fromAmino(e);
    })) || [];
    if (object.allowForking !== undefined && object.allowForking !== null) {
      message.allowForking = object.allowForking;
    }
    message.backups = ((_object$backups2 = object.backups) === null || _object$backups2 === void 0 ? void 0 : _object$backups2.map(function (e) {
      return RepositoryBackup.fromAmino(e);
    })) || [];
    if (object.enableArweaveBackup !== undefined && object.enableArweaveBackup !== null) {
      message.enableArweaveBackup = object.enableArweaveBackup;
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.creator = message.creator === "" ? undefined : message.creator;
    obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined;
    obj.name = message.name === "" ? undefined : message.name;
    obj.owner = message.owner ? RepositoryOwner.toAmino(message.owner) : undefined;
    obj.description = message.description === "" ? undefined : message.description;
    if (message.forks) {
      obj.forks = message.forks.map(function (e) {
        return e.toString();
      });
    } else {
      obj.forks = message.forks;
    }
    obj.subscribers = message.subscribers === "" ? undefined : message.subscribers;
    obj.commits = message.commits === "" ? undefined : message.commits;
    obj.issuesCount = message.issuesCount !== BigInt(0) ? message.issuesCount.toString() : undefined;
    obj.pullsCount = message.pullsCount !== BigInt(0) ? message.pullsCount.toString() : undefined;
    if (message.labels) {
      obj.labels = message.labels.map(function (e) {
        return e ? RepositoryLabel.toAmino(e) : undefined;
      });
    } else {
      obj.labels = message.labels;
    }
    obj.labelsCount = message.labelsCount !== BigInt(0) ? message.labelsCount.toString() : undefined;
    if (message.releases) {
      obj.releases = message.releases.map(function (e) {
        return e ? RepositoryRelease.toAmino(e) : undefined;
      });
    } else {
      obj.releases = message.releases;
    }
    obj.createdAt = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined;
    obj.updatedAt = message.updatedAt !== BigInt(0) ? message.updatedAt.toString() : undefined;
    obj.pushedAt = message.pushedAt !== BigInt(0) ? message.pushedAt.toString() : undefined;
    if (message.stargazers) {
      obj.stargazers = message.stargazers.map(function (e) {
        return e.toString();
      });
    } else {
      obj.stargazers = message.stargazers;
    }
    obj.archived = message.archived === false ? undefined : message.archived;
    obj.license = message.license === "" ? undefined : message.license;
    obj.defaultBranch = message.defaultBranch === "" ? undefined : message.defaultBranch;
    obj.parent = message.parent !== BigInt(0) ? message.parent.toString() : undefined;
    obj.fork = message.fork === false ? undefined : message.fork;
    if (message.collaborators) {
      obj.collaborators = message.collaborators.map(function (e) {
        return e ? RepositoryCollaborator.toAmino(e) : undefined;
      });
    } else {
      obj.collaborators = message.collaborators;
    }
    obj.allowForking = message.allowForking === false ? undefined : message.allowForking;
    if (message.backups) {
      obj.backups = message.backups.map(function (e) {
        return e ? RepositoryBackup.toAmino(e) : undefined;
      });
    } else {
      obj.backups = message.backups;
    }
    obj.enableArweaveBackup = message.enableArweaveBackup === false ? undefined : message.enableArweaveBackup;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return Repository.fromAmino(object.value);
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return Repository.decode(message.value);
  },
  toProto: function toProto(message) {
    return Repository.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.gitopia.Repository",
      value: Repository.encode(message).finish()
    };
  }
};
function createBaseRepositoryId() {
  return {
    id: "",
    name: ""
  };
}
var RepositoryId = exports.RepositoryId = {
  typeUrl: "/gitopia.gitopia.gitopia.RepositoryId",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.name !== "") {
      writer.uint32(18).string(message.name);
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? String(object.id) : "",
      name: (0, _helpers.isSet)(object.name) ? String(object.name) : ""
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$id, _object$name2;
    var message = createBaseRepositoryId();
    message.id = (_object$id = object.id) !== null && _object$id !== void 0 ? _object$id : "";
    message.name = (_object$name2 = object.name) !== null && _object$name2 !== void 0 ? _object$name2 : "";
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBaseRepositoryId();
    if (object.id !== undefined && object.id !== null) {
      message.id = object.id;
    }
    if (object.name !== undefined && object.name !== null) {
      message.name = object.name;
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.id = message.id === "" ? undefined : message.id;
    obj.name = message.name === "" ? undefined : message.name;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return RepositoryId.fromAmino(object.value);
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return RepositoryId.decode(message.value);
  },
  toProto: function toProto(message) {
    return RepositoryId.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.gitopia.RepositoryId",
      value: RepositoryId.encode(message).finish()
    };
  }
};
function createBaseBaseRepositoryKey() {
  return {
    id: BigInt(0),
    address: "",
    name: ""
  };
}
var BaseRepositoryKey = exports.BaseRepositoryKey = {
  typeUrl: "/gitopia.gitopia.gitopia.BaseRepositoryKey",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.id !== BigInt(0)) {
      writer.uint32(8).uint64(message.id);
    }
    if (message.address !== "") {
      writer.uint32(18).string(message.address);
    }
    if (message.name !== "") {
      writer.uint32(26).string(message.name);
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? BigInt(object.id.toString()) : BigInt(0),
      address: (0, _helpers.isSet)(object.address) ? String(object.address) : "",
      name: (0, _helpers.isSet)(object.name) ? String(object.name) : ""
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$address, _object$name3;
    var message = createBaseBaseRepositoryKey();
    message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0);
    message.address = (_object$address = object.address) !== null && _object$address !== void 0 ? _object$address : "";
    message.name = (_object$name3 = object.name) !== null && _object$name3 !== void 0 ? _object$name3 : "";
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBaseBaseRepositoryKey();
    if (object.id !== undefined && object.id !== null) {
      message.id = BigInt(object.id);
    }
    if (object.address !== undefined && object.address !== null) {
      message.address = object.address;
    }
    if (object.name !== undefined && object.name !== null) {
      message.name = object.name;
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined;
    obj.address = message.address === "" ? undefined : message.address;
    obj.name = message.name === "" ? undefined : message.name;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return BaseRepositoryKey.fromAmino(object.value);
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return BaseRepositoryKey.decode(message.value);
  },
  toProto: function toProto(message) {
    return BaseRepositoryKey.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.gitopia.BaseRepositoryKey",
      value: BaseRepositoryKey.encode(message).finish()
    };
  }
};
function createBaseRepositoryOwner() {
  return {
    id: "",
    type: 0
  };
}
var RepositoryOwner = exports.RepositoryOwner = {
  typeUrl: "/gitopia.gitopia.gitopia.RepositoryOwner",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.type !== 0) {
      writer.uint32(16).int32(message.type);
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? String(object.id) : "",
      type: (0, _helpers.isSet)(object.type) ? (0, _whois.ownerTypeFromJSON)(object.type) : -1
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$id2, _object$type;
    var message = createBaseRepositoryOwner();
    message.id = (_object$id2 = object.id) !== null && _object$id2 !== void 0 ? _object$id2 : "";
    message.type = (_object$type = object.type) !== null && _object$type !== void 0 ? _object$type : 0;
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBaseRepositoryOwner();
    if (object.id !== undefined && object.id !== null) {
      message.id = object.id;
    }
    if (object.type !== undefined && object.type !== null) {
      message.type = object.type;
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.id = message.id === "" ? undefined : message.id;
    obj.type = message.type === 0 ? undefined : message.type;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return RepositoryOwner.fromAmino(object.value);
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return RepositoryOwner.decode(message.value);
  },
  toProto: function toProto(message) {
    return RepositoryOwner.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.gitopia.RepositoryOwner",
      value: RepositoryOwner.encode(message).finish()
    };
  }
};
function createBaseIssueIid() {
  return {
    iid: BigInt(0),
    id: BigInt(0)
  };
}
var IssueIid = exports.IssueIid = {
  typeUrl: "/gitopia.gitopia.gitopia.IssueIid",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.iid !== BigInt(0)) {
      writer.uint32(8).uint64(message.iid);
    }
    if (message.id !== BigInt(0)) {
      writer.uint32(16).uint64(message.id);
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      iid: (0, _helpers.isSet)(object.iid) ? BigInt(object.iid.toString()) : BigInt(0),
      id: (0, _helpers.isSet)(object.id) ? BigInt(object.id.toString()) : BigInt(0)
    };
  },
  fromPartial: function fromPartial(object) {
    var message = createBaseIssueIid();
    message.iid = object.iid !== undefined && object.iid !== null ? BigInt(object.iid.toString()) : BigInt(0);
    message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0);
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBaseIssueIid();
    if (object.iid !== undefined && object.iid !== null) {
      message.iid = BigInt(object.iid);
    }
    if (object.id !== undefined && object.id !== null) {
      message.id = BigInt(object.id);
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.iid = message.iid !== BigInt(0) ? message.iid.toString() : undefined;
    obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return IssueIid.fromAmino(object.value);
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return IssueIid.decode(message.value);
  },
  toProto: function toProto(message) {
    return IssueIid.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.gitopia.IssueIid",
      value: IssueIid.encode(message).finish()
    };
  }
};
function createBasePullRequestIid() {
  return {
    iid: BigInt(0),
    id: BigInt(0)
  };
}
var PullRequestIid = exports.PullRequestIid = {
  typeUrl: "/gitopia.gitopia.gitopia.PullRequestIid",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.iid !== BigInt(0)) {
      writer.uint32(8).uint64(message.iid);
    }
    if (message.id !== BigInt(0)) {
      writer.uint32(16).uint64(message.id);
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      iid: (0, _helpers.isSet)(object.iid) ? BigInt(object.iid.toString()) : BigInt(0),
      id: (0, _helpers.isSet)(object.id) ? BigInt(object.id.toString()) : BigInt(0)
    };
  },
  fromPartial: function fromPartial(object) {
    var message = createBasePullRequestIid();
    message.iid = object.iid !== undefined && object.iid !== null ? BigInt(object.iid.toString()) : BigInt(0);
    message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0);
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBasePullRequestIid();
    if (object.iid !== undefined && object.iid !== null) {
      message.iid = BigInt(object.iid);
    }
    if (object.id !== undefined && object.id !== null) {
      message.id = BigInt(object.id);
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.iid = message.iid !== BigInt(0) ? message.iid.toString() : undefined;
    obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return PullRequestIid.fromAmino(object.value);
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return PullRequestIid.decode(message.value);
  },
  toProto: function toProto(message) {
    return PullRequestIid.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.gitopia.PullRequestIid",
      value: PullRequestIid.encode(message).finish()
    };
  }
};
function createBaseRepositoryCollaborator() {
  return {
    id: "",
    permission: 0
  };
}
var RepositoryCollaborator = exports.RepositoryCollaborator = {
  typeUrl: "/gitopia.gitopia.gitopia.RepositoryCollaborator",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.id !== "") {
      writer.uint32(10).string(message.id);
    }
    if (message.permission !== 0) {
      writer.uint32(16).int32(message.permission);
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? String(object.id) : "",
      permission: (0, _helpers.isSet)(object.permission) ? repositoryCollaborator_PermissionFromJSON(object.permission) : -1
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$id3, _object$permission;
    var message = createBaseRepositoryCollaborator();
    message.id = (_object$id3 = object.id) !== null && _object$id3 !== void 0 ? _object$id3 : "";
    message.permission = (_object$permission = object.permission) !== null && _object$permission !== void 0 ? _object$permission : 0;
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBaseRepositoryCollaborator();
    if (object.id !== undefined && object.id !== null) {
      message.id = object.id;
    }
    if (object.permission !== undefined && object.permission !== null) {
      message.permission = object.permission;
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.id = message.id === "" ? undefined : message.id;
    obj.permission = message.permission === 0 ? undefined : message.permission;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return RepositoryCollaborator.fromAmino(object.value);
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return RepositoryCollaborator.decode(message.value);
  },
  toProto: function toProto(message) {
    return RepositoryCollaborator.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.gitopia.RepositoryCollaborator",
      value: RepositoryCollaborator.encode(message).finish()
    };
  }
};
function createBaseRepositoryLabel() {
  return {
    id: BigInt(0),
    name: "",
    color: "",
    description: ""
  };
}
var RepositoryLabel = exports.RepositoryLabel = {
  typeUrl: "/gitopia.gitopia.gitopia.RepositoryLabel",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.id !== BigInt(0)) {
      writer.uint32(8).uint64(message.id);
    }
    if (message.name !== "") {
      writer.uint32(18).string(message.name);
    }
    if (message.color !== "") {
      writer.uint32(26).string(message.color);
    }
    if (message.description !== "") {
      writer.uint32(34).string(message.description);
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? BigInt(object.id.toString()) : BigInt(0),
      name: (0, _helpers.isSet)(object.name) ? String(object.name) : "",
      color: (0, _helpers.isSet)(object.color) ? String(object.color) : "",
      description: (0, _helpers.isSet)(object.description) ? String(object.description) : ""
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$name4, _object$color, _object$description2;
    var message = createBaseRepositoryLabel();
    message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0);
    message.name = (_object$name4 = object.name) !== null && _object$name4 !== void 0 ? _object$name4 : "";
    message.color = (_object$color = object.color) !== null && _object$color !== void 0 ? _object$color : "";
    message.description = (_object$description2 = object.description) !== null && _object$description2 !== void 0 ? _object$description2 : "";
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBaseRepositoryLabel();
    if (object.id !== undefined && object.id !== null) {
      message.id = BigInt(object.id);
    }
    if (object.name !== undefined && object.name !== null) {
      message.name = object.name;
    }
    if (object.color !== undefined && object.color !== null) {
      message.color = object.color;
    }
    if (object.description !== undefined && object.description !== null) {
      message.description = object.description;
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined;
    obj.name = message.name === "" ? undefined : message.name;
    obj.color = message.color === "" ? undefined : message.color;
    obj.description = message.description === "" ? undefined : message.description;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return RepositoryLabel.fromAmino(object.value);
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return RepositoryLabel.decode(message.value);
  },
  toProto: function toProto(message) {
    return RepositoryLabel.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.gitopia.RepositoryLabel",
      value: RepositoryLabel.encode(message).finish()
    };
  }
};
function createBaseRepositoryRelease() {
  return {
    id: BigInt(0),
    tagName: ""
  };
}
var RepositoryRelease = exports.RepositoryRelease = {
  typeUrl: "/gitopia.gitopia.gitopia.RepositoryRelease",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.id !== BigInt(0)) {
      writer.uint32(8).uint64(message.id);
    }
    if (message.tagName !== "") {
      writer.uint32(18).string(message.tagName);
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? BigInt(object.id.toString()) : BigInt(0),
      tagName: (0, _helpers.isSet)(object.tagName) ? String(object.tagName) : ""
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$tagName;
    var message = createBaseRepositoryRelease();
    message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0);
    message.tagName = (_object$tagName = object.tagName) !== null && _object$tagName !== void 0 ? _object$tagName : "";
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBaseRepositoryRelease();
    if (object.id !== undefined && object.id !== null) {
      message.id = BigInt(object.id);
    }
    if (object.tagName !== undefined && object.tagName !== null) {
      message.tagName = object.tagName;
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined;
    obj.tagName = message.tagName === "" ? undefined : message.tagName;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return RepositoryRelease.fromAmino(object.value);
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return RepositoryRelease.decode(message.value);
  },
  toProto: function toProto(message) {
    return RepositoryRelease.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.gitopia.RepositoryRelease",
      value: RepositoryRelease.encode(message).finish()
    };
  }
};
function createBaseRepositoryBackup() {
  return {
    store: 0,
    refs: []
  };
}
var RepositoryBackup = exports.RepositoryBackup = {
  typeUrl: "/gitopia.gitopia.gitopia.RepositoryBackup",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.store !== 0) {
      writer.uint32(8).int32(message.store);
    }
    var _iterator7 = _createForOfIteratorHelper(message.refs),
      _step7;
    try {
      for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
        var v = _step7.value;
        writer.uint32(18).string(v);
      }
    } catch (err) {
      _iterator7.e(err);
    } finally {
      _iterator7.f();
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      store: (0, _helpers.isSet)(object.store) ? repositoryBackup_StoreFromJSON(object.store) : -1,
      refs: Array.isArray(object === null || object === void 0 ? void 0 : object.refs) ? object.refs.map(function (e) {
        return String(e);
      }) : []
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$store, _object$refs;
    var message = createBaseRepositoryBackup();
    message.store = (_object$store = object.store) !== null && _object$store !== void 0 ? _object$store : 0;
    message.refs = ((_object$refs = object.refs) === null || _object$refs === void 0 ? void 0 : _object$refs.map(function (e) {
      return e;
    })) || [];
    return message;
  },
  fromAmino: function fromAmino(object) {
    var _object$refs2;
    var message = createBaseRepositoryBackup();
    if (object.store !== undefined && object.store !== null) {
      message.store = object.store;
    }
    message.refs = ((_object$refs2 = object.refs) === null || _object$refs2 === void 0 ? void 0 : _object$refs2.map(function (e) {
      return e;
    })) || [];
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.store = message.store === 0 ? undefined : message.store;
    if (message.refs) {
      obj.refs = message.refs.map(function (e) {
        return e;
      });
    } else {
      obj.refs = message.refs;
    }
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return RepositoryBackup.fromAmino(object.value);
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return RepositoryBackup.decode(message.value);
  },
  toProto: function toProto(message) {
    return RepositoryBackup.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.gitopia.RepositoryBackup",
      value: RepositoryBackup.encode(message).finish()
    };
  }
};