import { BinaryWriter } from "../binary";
import { isSet } from "../helpers";
export let Emoji = /*#__PURE__*/function (Emoji) {
  Emoji[Emoji["EMOJI_THUMBS_UP"] = 0] = "EMOJI_THUMBS_UP";
  Emoji[Emoji["EMOJI_THUMBS_DOWN"] = 1] = "EMOJI_THUMBS_DOWN";
  Emoji[Emoji["UNRECOGNIZED"] = -1] = "UNRECOGNIZED";
  return Emoji;
}({});
export const EmojiSDKType = Emoji;
export const EmojiAmino = Emoji;
export function emojiFromJSON(object) {
  switch (object) {
    case 0:
    case "EMOJI_THUMBS_UP":
      return Emoji.EMOJI_THUMBS_UP;
    case 1:
    case "EMOJI_THUMBS_DOWN":
      return Emoji.EMOJI_THUMBS_DOWN;
    case -1:
    case "UNRECOGNIZED":
    default:
      return Emoji.UNRECOGNIZED;
  }
}
export function emojiToJSON(object) {
  switch (object) {
    case Emoji.EMOJI_THUMBS_UP:
      return "EMOJI_THUMBS_UP";
    case Emoji.EMOJI_THUMBS_DOWN:
      return "EMOJI_THUMBS_DOWN";
    case Emoji.UNRECOGNIZED:
    default:
      return "UNRECOGNIZED";
  }
}
function createBaseReaction() {
  return {
    address: "",
    emojis: []
  };
}
export const Reaction = {
  typeUrl: "/gitopia.gitopia.gitopia.Reaction",
  encode(message, writer = BinaryWriter.create()) {
    if (message.address !== "") {
      writer.uint32(10).string(message.address);
    }
    writer.uint32(18).fork();
    for (const v of message.emojis) {
      writer.int32(v);
    }
    writer.ldelim();
    return writer;
  },
  fromJSON(object) {
    return {
      address: isSet(object.address) ? String(object.address) : "",
      emojis: Array.isArray(object === null || object === void 0 ? void 0 : object.emojis) ? object.emojis.map(e => emojiFromJSON(e)) : []
    };
  },
  fromPartial(object) {
    var _object$address, _object$emojis;
    const message = createBaseReaction();
    message.address = (_object$address = object.address) !== null && _object$address !== void 0 ? _object$address : "";
    message.emojis = ((_object$emojis = object.emojis) === null || _object$emojis === void 0 ? void 0 : _object$emojis.map(e => e)) || [];
    return message;
  },
  fromAmino(object) {
    var _object$emojis2;
    const message = createBaseReaction();
    if (object.address !== undefined && object.address !== null) {
      message.address = object.address;
    }
    message.emojis = ((_object$emojis2 = object.emojis) === null || _object$emojis2 === void 0 ? void 0 : _object$emojis2.map(e => e)) || [];
    return message;
  },
  toAmino(message) {
    const obj = {};
    obj.address = message.address === "" ? undefined : message.address;
    if (message.emojis) {
      obj.emojis = message.emojis.map(e => e);
    } else {
      obj.emojis = message.emojis;
    }
    return obj;
  },
  fromAminoMsg(object) {
    return Reaction.fromAmino(object.value);
  },
  fromProtoMsg(message) {
    return Reaction.decode(message.value);
  },
  toProto(message) {
    return Reaction.encode(message).finish();
  },
  toProtoMsg(message) {
    return {
      typeUrl: "/gitopia.gitopia.gitopia.Reaction",
      value: Reaction.encode(message).finish()
    };
  }
};