"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Tag = void 0;
var _binary = require("../binary");
var _helpers = require("../helpers");
function createBaseTag() {
  return {
    id: BigInt(0),
    repositoryId: BigInt(0),
    name: "",
    sha: "",
    createdAt: BigInt(0),
    updatedAt: BigInt(0)
  };
}
var Tag = exports.Tag = {
  typeUrl: "/gitopia.gitopia.gitopia.Tag",
  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.repositoryId !== BigInt(0)) {
      writer.uint32(16).uint64(message.repositoryId);
    }
    if (message.name !== "") {
      writer.uint32(26).string(message.name);
    }
    if (message.sha !== "") {
      writer.uint32(34).string(message.sha);
    }
    if (message.createdAt !== BigInt(0)) {
      writer.uint32(40).int64(message.createdAt);
    }
    if (message.updatedAt !== BigInt(0)) {
      writer.uint32(48).int64(message.updatedAt);
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      id: (0, _helpers.isSet)(object.id) ? BigInt(object.id.toString()) : BigInt(0),
      repositoryId: (0, _helpers.isSet)(object.repositoryId) ? BigInt(object.repositoryId.toString()) : BigInt(0),
      name: (0, _helpers.isSet)(object.name) ? String(object.name) : "",
      sha: (0, _helpers.isSet)(object.sha) ? String(object.sha) : "",
      createdAt: (0, _helpers.isSet)(object.createdAt) ? BigInt(object.createdAt.toString()) : BigInt(0),
      updatedAt: (0, _helpers.isSet)(object.updatedAt) ? BigInt(object.updatedAt.toString()) : BigInt(0)
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$name, _object$sha;
    var message = createBaseTag();
    message.id = object.id !== undefined && object.id !== null ? BigInt(object.id.toString()) : BigInt(0);
    message.repositoryId = object.repositoryId !== undefined && object.repositoryId !== null ? BigInt(object.repositoryId.toString()) : BigInt(0);
    message.name = (_object$name = object.name) !== null && _object$name !== void 0 ? _object$name : "";
    message.sha = (_object$sha = object.sha) !== null && _object$sha !== void 0 ? _object$sha : "";
    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);
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBaseTag();
    if (object.id !== undefined && object.id !== null) {
      message.id = BigInt(object.id);
    }
    if (object.repositoryId !== undefined && object.repositoryId !== null) {
      message.repositoryId = BigInt(object.repositoryId);
    }
    if (object.name !== undefined && object.name !== null) {
      message.name = object.name;
    }
    if (object.sha !== undefined && object.sha !== null) {
      message.sha = object.sha;
    }
    if (object.createdAt !== undefined && object.createdAt !== null) {
      message.createdAt = BigInt(object.createdAt);
    }
    if (object.updatedAt !== undefined && object.updatedAt !== null) {
      message.updatedAt = BigInt(object.updatedAt);
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined;
    obj.repositoryId = message.repositoryId !== BigInt(0) ? message.repositoryId.toString() : undefined;
    obj.name = message.name === "" ? undefined : message.name;
    obj.sha = message.sha === "" ? undefined : message.sha;
    obj.createdAt = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined;
    obj.updatedAt = message.updatedAt !== BigInt(0) ? message.updatedAt.toString() : undefined;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return Tag.fromAmino(object.value);
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return Tag.decode(message.value);
  },
  toProto: function toProto(message) {
    return Tag.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.gitopia.Tag",
      value: Tag.encode(message).finish()
    };
  }
};