"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.PullRequest_StateSDKType = exports.PullRequest_StateAmino = exports.PullRequest_State = exports.PullRequestHead = exports.PullRequestBase = exports.PullRequest = void 0;
exports.pullRequest_StateFromJSON = pullRequest_StateFromJSON;
exports.pullRequest_StateToJSON = pullRequest_StateToJSON;
var _repository = require("./repository");
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 PullRequest_State = exports.PullRequest_State = /*#__PURE__*/function (PullRequest_State) {
  PullRequest_State[PullRequest_State["OPEN"] = 0] = "OPEN";
  PullRequest_State[PullRequest_State["CLOSED"] = 1] = "CLOSED";
  PullRequest_State[PullRequest_State["MERGED"] = 2] = "MERGED";
  PullRequest_State[PullRequest_State["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return PullRequest_State;
}({});
var PullRequest_StateSDKType = exports.PullRequest_StateSDKType = PullRequest_State;
var PullRequest_StateAmino = exports.PullRequest_StateAmino = PullRequest_State;
function pullRequest_StateFromJSON(object) {
  switch (object) {
    case 0:
    case "OPEN":
      return PullRequest_State.OPEN;
    case 1:
    case "CLOSED":
      return PullRequest_State.CLOSED;
    case 2:
    case "MERGED":
      return PullRequest_State.MERGED;
    case -1:
    case "UNRECOGNIZED":
    default:
      return PullRequest_State.UNRECOGNIZED;
  }
}
function pullRequest_StateToJSON(object) {
  switch (object) {
    case PullRequest_State.OPEN:
      return "OPEN";
    case PullRequest_State.CLOSED:
      return "CLOSED";
    case PullRequest_State.MERGED:
      return "MERGED";
    case PullRequest_State.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
function createBasePullRequest() {
  return {
    creator: "",
    id: BigInt(0),
    iid: BigInt(0),
    title: "",
    state: 0,
    description: "",
    locked: false,
    commentsCount: BigInt(0),
    issues: [],
    labels: [],
    assignees: [],
    reviewers: [],
    draft: false,
    createdAt: BigInt(0),
    updatedAt: BigInt(0),
    closedAt: BigInt(0),
    closedBy: "",
    mergedAt: BigInt(0),
    mergedBy: "",
    mergeCommitSha: "",
    maintainerCanModify: false,
    head: undefined,
    base: undefined
  };
}
var PullRequest = exports.PullRequest = {
  typeUrl: "/gitopia.gitopia.gitopia.PullRequest",
  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.iid !== BigInt(0)) {
      writer.uint32(24).uint64(message.iid);
    }
    if (message.title !== "") {
      writer.uint32(34).string(message.title);
    }
    if (message.state !== 0) {
      writer.uint32(40).int32(message.state);
    }
    if (message.description !== "") {
      writer.uint32(50).string(message.description);
    }
    if (message.locked === true) {
      writer.uint32(56).bool(message.locked);
    }
    if (message.commentsCount !== BigInt(0)) {
      writer.uint32(64).uint64(message.commentsCount);
    }
    var _iterator = _createForOfIteratorHelper(message.issues),
      _step;
    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var v = _step.value;
        _repository.IssueIid.encode(v, writer.uint32(74).fork()).ldelim();
      }
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
    writer.uint32(82).fork();
    var _iterator2 = _createForOfIteratorHelper(message.labels),
      _step2;
    try {
      for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
        var _v = _step2.value;
        writer.uint64(_v);
      }
    } catch (err) {
      _iterator2.e(err);
    } finally {
      _iterator2.f();
    }
    writer.ldelim();
    var _iterator3 = _createForOfIteratorHelper(message.assignees),
      _step3;
    try {
      for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
        var _v2 = _step3.value;
        writer.uint32(90).string(_v2);
      }
    } catch (err) {
      _iterator3.e(err);
    } finally {
      _iterator3.f();
    }
    var _iterator4 = _createForOfIteratorHelper(message.reviewers),
      _step4;
    try {
      for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
        var _v3 = _step4.value;
        writer.uint32(98).string(_v3);
      }
    } catch (err) {
      _iterator4.e(err);
    } finally {
      _iterator4.f();
    }
    if (message.draft === true) {
      writer.uint32(104).bool(message.draft);
    }
    if (message.createdAt !== BigInt(0)) {
      writer.uint32(112).int64(message.createdAt);
    }
    if (message.updatedAt !== BigInt(0)) {
      writer.uint32(120).int64(message.updatedAt);
    }
    if (message.closedAt !== BigInt(0)) {
      writer.uint32(128).int64(message.closedAt);
    }
    if (message.closedBy !== "") {
      writer.uint32(138).string(message.closedBy);
    }
    if (message.mergedAt !== BigInt(0)) {
      writer.uint32(144).int64(message.mergedAt);
    }
    if (message.mergedBy !== "") {
      writer.uint32(154).string(message.mergedBy);
    }
    if (message.mergeCommitSha !== "") {
      writer.uint32(162).string(message.mergeCommitSha);
    }
    if (message.maintainerCanModify === true) {
      writer.uint32(168).bool(message.maintainerCanModify);
    }
    if (message.head !== undefined) {
      PullRequestHead.encode(message.head, writer.uint32(178).fork()).ldelim();
    }
    if (message.base !== undefined) {
      PullRequestBase.encode(message.base, writer.uint32(186).fork()).ldelim();
    }
    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),
      iid: (0, _helpers.isSet)(object.iid) ? BigInt(object.iid.toString()) : BigInt(0),
      title: (0, _helpers.isSet)(object.title) ? String(object.title) : "",
      state: (0, _helpers.isSet)(object.state) ? pullRequest_StateFromJSON(object.state) : -1,
      description: (0, _helpers.isSet)(object.description) ? String(object.description) : "",
      locked: (0, _helpers.isSet)(object.locked) ? Boolean(object.locked) : false,
      commentsCount: (0, _helpers.isSet)(object.commentsCount) ? BigInt(object.commentsCount.toString()) : BigInt(0),
      issues: Array.isArray(object === null || object === void 0 ? void 0 : object.issues) ? object.issues.map(function (e) {
        return _repository.IssueIid.fromJSON(e);
      }) : [],
      labels: Array.isArray(object === null || object === void 0 ? void 0 : object.labels) ? object.labels.map(function (e) {
        return BigInt(e.toString());
      }) : [],
      assignees: Array.isArray(object === null || object === void 0 ? void 0 : object.assignees) ? object.assignees.map(function (e) {
        return String(e);
      }) : [],
      reviewers: Array.isArray(object === null || object === void 0 ? void 0 : object.reviewers) ? object.reviewers.map(function (e) {
        return String(e);
      }) : [],
      draft: (0, _helpers.isSet)(object.draft) ? Boolean(object.draft) : false,
      createdAt: (0, _helpers.isSet)(object.createdAt) ? BigInt(object.createdAt.toString()) : BigInt(0),
      updatedAt: (0, _helpers.isSet)(object.updatedAt) ? BigInt(object.updatedAt.toString()) : BigInt(0),
      closedAt: (0, _helpers.isSet)(object.closedAt) ? BigInt(object.closedAt.toString()) : BigInt(0),
      closedBy: (0, _helpers.isSet)(object.closedBy) ? String(object.closedBy) : "",
      mergedAt: (0, _helpers.isSet)(object.mergedAt) ? BigInt(object.mergedAt.toString()) : BigInt(0),
      mergedBy: (0, _helpers.isSet)(object.mergedBy) ? String(object.mergedBy) : "",
      mergeCommitSha: (0, _helpers.isSet)(object.mergeCommitSha) ? String(object.mergeCommitSha) : "",
      maintainerCanModify: (0, _helpers.isSet)(object.maintainerCanModify) ? Boolean(object.maintainerCanModify) : false,
      head: (0, _helpers.isSet)(object.head) ? PullRequestHead.fromJSON(object.head) : undefined,
      base: (0, _helpers.isSet)(object.base) ? PullRequestBase.fromJSON(object.base) : undefined
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$creator, _object$title, _object$state, _object$description, _object$locked, _object$issues, _object$labels, _object$assignees, _object$reviewers, _object$draft, _object$closedBy, _object$mergedBy, _object$mergeCommitSh, _object$maintainerCan;
    var message = createBasePullRequest();
    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.iid = object.iid !== undefined && object.iid !== null ? BigInt(object.iid.toString()) : BigInt(0);
    message.title = (_object$title = object.title) !== null && _object$title !== void 0 ? _object$title : "";
    message.state = (_object$state = object.state) !== null && _object$state !== void 0 ? _object$state : 0;
    message.description = (_object$description = object.description) !== null && _object$description !== void 0 ? _object$description : "";
    message.locked = (_object$locked = object.locked) !== null && _object$locked !== void 0 ? _object$locked : false;
    message.commentsCount = object.commentsCount !== undefined && object.commentsCount !== null ? BigInt(object.commentsCount.toString()) : BigInt(0);
    message.issues = ((_object$issues = object.issues) === null || _object$issues === void 0 ? void 0 : _object$issues.map(function (e) {
      return _repository.IssueIid.fromPartial(e);
    })) || [];
    message.labels = ((_object$labels = object.labels) === null || _object$labels === void 0 ? void 0 : _object$labels.map(function (e) {
      return BigInt(e.toString());
    })) || [];
    message.assignees = ((_object$assignees = object.assignees) === null || _object$assignees === void 0 ? void 0 : _object$assignees.map(function (e) {
      return e;
    })) || [];
    message.reviewers = ((_object$reviewers = object.reviewers) === null || _object$reviewers === void 0 ? void 0 : _object$reviewers.map(function (e) {
      return e;
    })) || [];
    message.draft = (_object$draft = object.draft) !== null && _object$draft !== void 0 ? _object$draft : false;
    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.closedAt = object.closedAt !== undefined && object.closedAt !== null ? BigInt(object.closedAt.toString()) : BigInt(0);
    message.closedBy = (_object$closedBy = object.closedBy) !== null && _object$closedBy !== void 0 ? _object$closedBy : "";
    message.mergedAt = object.mergedAt !== undefined && object.mergedAt !== null ? BigInt(object.mergedAt.toString()) : BigInt(0);
    message.mergedBy = (_object$mergedBy = object.mergedBy) !== null && _object$mergedBy !== void 0 ? _object$mergedBy : "";
    message.mergeCommitSha = (_object$mergeCommitSh = object.mergeCommitSha) !== null && _object$mergeCommitSh !== void 0 ? _object$mergeCommitSh : "";
    message.maintainerCanModify = (_object$maintainerCan = object.maintainerCanModify) !== null && _object$maintainerCan !== void 0 ? _object$maintainerCan : false;
    message.head = object.head !== undefined && object.head !== null ? PullRequestHead.fromPartial(object.head) : undefined;
    message.base = object.base !== undefined && object.base !== null ? PullRequestBase.fromPartial(object.base) : undefined;
    return message;
  },
  fromAmino: function fromAmino(object) {
    var _object$issues2, _object$labels2, _object$assignees2, _object$reviewers2;
    var message = createBasePullRequest();
    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.iid !== undefined && object.iid !== null) {
      message.iid = BigInt(object.iid);
    }
    if (object.title !== undefined && object.title !== null) {
      message.title = object.title;
    }
    if (object.state !== undefined && object.state !== null) {
      message.state = object.state;
    }
    if (object.description !== undefined && object.description !== null) {
      message.description = object.description;
    }
    if (object.locked !== undefined && object.locked !== null) {
      message.locked = object.locked;
    }
    if (object.commentsCount !== undefined && object.commentsCount !== null) {
      message.commentsCount = BigInt(object.commentsCount);
    }
    message.issues = ((_object$issues2 = object.issues) === null || _object$issues2 === void 0 ? void 0 : _object$issues2.map(function (e) {
      return _repository.IssueIid.fromAmino(e);
    })) || [];
    message.labels = ((_object$labels2 = object.labels) === null || _object$labels2 === void 0 ? void 0 : _object$labels2.map(function (e) {
      return BigInt(e);
    })) || [];
    message.assignees = ((_object$assignees2 = object.assignees) === null || _object$assignees2 === void 0 ? void 0 : _object$assignees2.map(function (e) {
      return e;
    })) || [];
    message.reviewers = ((_object$reviewers2 = object.reviewers) === null || _object$reviewers2 === void 0 ? void 0 : _object$reviewers2.map(function (e) {
      return e;
    })) || [];
    if (object.draft !== undefined && object.draft !== null) {
      message.draft = object.draft;
    }
    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.closedAt !== undefined && object.closedAt !== null) {
      message.closedAt = BigInt(object.closedAt);
    }
    if (object.closedBy !== undefined && object.closedBy !== null) {
      message.closedBy = object.closedBy;
    }
    if (object.mergedAt !== undefined && object.mergedAt !== null) {
      message.mergedAt = BigInt(object.mergedAt);
    }
    if (object.mergedBy !== undefined && object.mergedBy !== null) {
      message.mergedBy = object.mergedBy;
    }
    if (object.mergeCommitSha !== undefined && object.mergeCommitSha !== null) {
      message.mergeCommitSha = object.mergeCommitSha;
    }
    if (object.maintainerCanModify !== undefined && object.maintainerCanModify !== null) {
      message.maintainerCanModify = object.maintainerCanModify;
    }
    if (object.head !== undefined && object.head !== null) {
      message.head = PullRequestHead.fromAmino(object.head);
    }
    if (object.base !== undefined && object.base !== null) {
      message.base = PullRequestBase.fromAmino(object.base);
    }
    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.iid = message.iid !== BigInt(0) ? message.iid.toString() : undefined;
    obj.title = message.title === "" ? undefined : message.title;
    obj.state = message.state === 0 ? undefined : message.state;
    obj.description = message.description === "" ? undefined : message.description;
    obj.locked = message.locked === false ? undefined : message.locked;
    obj.commentsCount = message.commentsCount !== BigInt(0) ? message.commentsCount.toString() : undefined;
    if (message.issues) {
      obj.issues = message.issues.map(function (e) {
        return e ? _repository.IssueIid.toAmino(e) : undefined;
      });
    } else {
      obj.issues = message.issues;
    }
    if (message.labels) {
      obj.labels = message.labels.map(function (e) {
        return e.toString();
      });
    } else {
      obj.labels = message.labels;
    }
    if (message.assignees) {
      obj.assignees = message.assignees.map(function (e) {
        return e;
      });
    } else {
      obj.assignees = message.assignees;
    }
    if (message.reviewers) {
      obj.reviewers = message.reviewers.map(function (e) {
        return e;
      });
    } else {
      obj.reviewers = message.reviewers;
    }
    obj.draft = message.draft === false ? undefined : message.draft;
    obj.createdAt = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined;
    obj.updatedAt = message.updatedAt !== BigInt(0) ? message.updatedAt.toString() : undefined;
    obj.closedAt = message.closedAt !== BigInt(0) ? message.closedAt.toString() : undefined;
    obj.closedBy = message.closedBy === "" ? undefined : message.closedBy;
    obj.mergedAt = message.mergedAt !== BigInt(0) ? message.mergedAt.toString() : undefined;
    obj.mergedBy = message.mergedBy === "" ? undefined : message.mergedBy;
    obj.mergeCommitSha = message.mergeCommitSha === "" ? undefined : message.mergeCommitSha;
    obj.maintainerCanModify = message.maintainerCanModify === false ? undefined : message.maintainerCanModify;
    obj.head = message.head ? PullRequestHead.toAmino(message.head) : undefined;
    obj.base = message.base ? PullRequestBase.toAmino(message.base) : undefined;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return PullRequest.fromAmino(object.value);
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return PullRequest.decode(message.value);
  },
  toProto: function toProto(message) {
    return PullRequest.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.gitopia.PullRequest",
      value: PullRequest.encode(message).finish()
    };
  }
};
function createBasePullRequestHead() {
  return {
    repositoryId: BigInt(0),
    branch: "",
    commitSha: ""
  };
}
var PullRequestHead = exports.PullRequestHead = {
  typeUrl: "/gitopia.gitopia.gitopia.PullRequestHead",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.repositoryId !== BigInt(0)) {
      writer.uint32(8).uint64(message.repositoryId);
    }
    if (message.branch !== "") {
      writer.uint32(18).string(message.branch);
    }
    if (message.commitSha !== "") {
      writer.uint32(26).string(message.commitSha);
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      repositoryId: (0, _helpers.isSet)(object.repositoryId) ? BigInt(object.repositoryId.toString()) : BigInt(0),
      branch: (0, _helpers.isSet)(object.branch) ? String(object.branch) : "",
      commitSha: (0, _helpers.isSet)(object.commitSha) ? String(object.commitSha) : ""
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$branch, _object$commitSha;
    var message = createBasePullRequestHead();
    message.repositoryId = object.repositoryId !== undefined && object.repositoryId !== null ? BigInt(object.repositoryId.toString()) : BigInt(0);
    message.branch = (_object$branch = object.branch) !== null && _object$branch !== void 0 ? _object$branch : "";
    message.commitSha = (_object$commitSha = object.commitSha) !== null && _object$commitSha !== void 0 ? _object$commitSha : "";
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBasePullRequestHead();
    if (object.repositoryId !== undefined && object.repositoryId !== null) {
      message.repositoryId = BigInt(object.repositoryId);
    }
    if (object.branch !== undefined && object.branch !== null) {
      message.branch = object.branch;
    }
    if (object.commitSha !== undefined && object.commitSha !== null) {
      message.commitSha = object.commitSha;
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.repositoryId = message.repositoryId !== BigInt(0) ? message.repositoryId.toString() : undefined;
    obj.branch = message.branch === "" ? undefined : message.branch;
    obj.commitSha = message.commitSha === "" ? undefined : message.commitSha;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return PullRequestHead.fromAmino(object.value);
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return PullRequestHead.decode(message.value);
  },
  toProto: function toProto(message) {
    return PullRequestHead.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.gitopia.PullRequestHead",
      value: PullRequestHead.encode(message).finish()
    };
  }
};
function createBasePullRequestBase() {
  return {
    repositoryId: BigInt(0),
    branch: "",
    commitSha: ""
  };
}
var PullRequestBase = exports.PullRequestBase = {
  typeUrl: "/gitopia.gitopia.gitopia.PullRequestBase",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.repositoryId !== BigInt(0)) {
      writer.uint32(8).uint64(message.repositoryId);
    }
    if (message.branch !== "") {
      writer.uint32(18).string(message.branch);
    }
    if (message.commitSha !== "") {
      writer.uint32(26).string(message.commitSha);
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      repositoryId: (0, _helpers.isSet)(object.repositoryId) ? BigInt(object.repositoryId.toString()) : BigInt(0),
      branch: (0, _helpers.isSet)(object.branch) ? String(object.branch) : "",
      commitSha: (0, _helpers.isSet)(object.commitSha) ? String(object.commitSha) : ""
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$branch2, _object$commitSha2;
    var message = createBasePullRequestBase();
    message.repositoryId = object.repositoryId !== undefined && object.repositoryId !== null ? BigInt(object.repositoryId.toString()) : BigInt(0);
    message.branch = (_object$branch2 = object.branch) !== null && _object$branch2 !== void 0 ? _object$branch2 : "";
    message.commitSha = (_object$commitSha2 = object.commitSha) !== null && _object$commitSha2 !== void 0 ? _object$commitSha2 : "";
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBasePullRequestBase();
    if (object.repositoryId !== undefined && object.repositoryId !== null) {
      message.repositoryId = BigInt(object.repositoryId);
    }
    if (object.branch !== undefined && object.branch !== null) {
      message.branch = object.branch;
    }
    if (object.commitSha !== undefined && object.commitSha !== null) {
      message.commitSha = object.commitSha;
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.repositoryId = message.repositoryId !== BigInt(0) ? message.repositoryId.toString() : undefined;
    obj.branch = message.branch === "" ? undefined : message.branch;
    obj.commitSha = message.commitSha === "" ? undefined : message.commitSha;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return PullRequestBase.fromAmino(object.value);
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return PullRequestBase.decode(message.value);
  },
  toProto: function toProto(message) {
    return PullRequestBase.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.gitopia.PullRequestBase",
      value: PullRequestBase.encode(message).finish()
    };
  }
};