"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.MsgSubmitEvidenceResponse = exports.MsgSubmitEvidence = exports.Evidence_ToAmino = exports.Evidence_InterfaceDecoder = exports.Evidence_FromAmino = void 0;
var _any = require("../../../google/protobuf/any");
var _binary = require("../../../binary");
var _helpers = require("../../../helpers");
/**
 * MsgSubmitEvidence represents a message that supports submitting arbitrary
 * Evidence of misbehavior such as equivocation or counterfactual signing.
 */

/**
 * MsgSubmitEvidence represents a message that supports submitting arbitrary
 * Evidence of misbehavior such as equivocation or counterfactual signing.
 */

/**
 * MsgSubmitEvidence represents a message that supports submitting arbitrary
 * Evidence of misbehavior such as equivocation or counterfactual signing.
 */

/** MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response type. */

/** MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response type. */

/** MsgSubmitEvidenceResponse defines the Msg/SubmitEvidence response type. */

function createBaseMsgSubmitEvidence() {
  return {
    submitter: "",
    evidence: undefined
  };
}
var MsgSubmitEvidence = exports.MsgSubmitEvidence = {
  typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidence",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.submitter !== "") {
      writer.uint32(10).string(message.submitter);
    }
    if (message.evidence !== undefined) {
      _any.Any.encode(message.evidence, writer.uint32(18).fork()).ldelim();
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      submitter: (0, _helpers.isSet)(object.submitter) ? String(object.submitter) : "",
      evidence: (0, _helpers.isSet)(object.evidence) ? _any.Any.fromJSON(object.evidence) : undefined
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$submitter;
    var message = createBaseMsgSubmitEvidence();
    message.submitter = (_object$submitter = object.submitter) !== null && _object$submitter !== void 0 ? _object$submitter : "";
    message.evidence = object.evidence !== undefined && object.evidence !== null ? _any.Any.fromPartial(object.evidence) : undefined;
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBaseMsgSubmitEvidence();
    if (object.submitter !== undefined && object.submitter !== null) {
      message.submitter = object.submitter;
    }
    if (object.evidence !== undefined && object.evidence !== null) {
      message.evidence = Evidence_FromAmino(object.evidence);
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.submitter = message.submitter === "" ? undefined : message.submitter;
    obj.evidence = message.evidence ? Evidence_ToAmino(message.evidence) : undefined;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return MsgSubmitEvidence.fromAmino(object.value);
  },
  toAminoMsg: function toAminoMsg(message) {
    return {
      type: "cosmos-sdk/MsgSubmitEvidence",
      value: MsgSubmitEvidence.toAmino(message)
    };
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return MsgSubmitEvidence.decode(message.value);
  },
  toProto: function toProto(message) {
    return MsgSubmitEvidence.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidence",
      value: MsgSubmitEvidence.encode(message).finish()
    };
  }
};
function createBaseMsgSubmitEvidenceResponse() {
  return {
    hash: new Uint8Array()
  };
}
var MsgSubmitEvidenceResponse = exports.MsgSubmitEvidenceResponse = {
  typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse",
  encode: function encode(message) {
    var writer = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _binary.BinaryWriter.create();
    if (message.hash.length !== 0) {
      writer.uint32(34).bytes(message.hash);
    }
    return writer;
  },
  fromJSON: function fromJSON(object) {
    return {
      hash: (0, _helpers.isSet)(object.hash) ? (0, _helpers.bytesFromBase64)(object.hash) : new Uint8Array()
    };
  },
  fromPartial: function fromPartial(object) {
    var _object$hash;
    var message = createBaseMsgSubmitEvidenceResponse();
    message.hash = (_object$hash = object.hash) !== null && _object$hash !== void 0 ? _object$hash : new Uint8Array();
    return message;
  },
  fromAmino: function fromAmino(object) {
    var message = createBaseMsgSubmitEvidenceResponse();
    if (object.hash !== undefined && object.hash !== null) {
      message.hash = (0, _helpers.bytesFromBase64)(object.hash);
    }
    return message;
  },
  toAmino: function toAmino(message) {
    var obj = {};
    obj.hash = message.hash ? (0, _helpers.base64FromBytes)(message.hash) : undefined;
    return obj;
  },
  fromAminoMsg: function fromAminoMsg(object) {
    return MsgSubmitEvidenceResponse.fromAmino(object.value);
  },
  toAminoMsg: function toAminoMsg(message) {
    return {
      type: "cosmos-sdk/MsgSubmitEvidenceResponse",
      value: MsgSubmitEvidenceResponse.toAmino(message)
    };
  },
  fromProtoMsg: function fromProtoMsg(message) {
    return MsgSubmitEvidenceResponse.decode(message.value);
  },
  toProto: function toProto(message) {
    return MsgSubmitEvidenceResponse.encode(message).finish();
  },
  toProtoMsg: function toProtoMsg(message) {
    return {
      typeUrl: "/cosmos.evidence.v1beta1.MsgSubmitEvidenceResponse",
      value: MsgSubmitEvidenceResponse.encode(message).finish()
    };
  }
};
var Evidence_InterfaceDecoder = exports.Evidence_InterfaceDecoder = function Evidence_InterfaceDecoder(input) {
  var reader = input instanceof _binary.BinaryReader ? input : new _binary.BinaryReader(input);
  var data = _any.Any.decode(reader, reader.uint32());
  switch (data.typeUrl) {
    default:
      return data;
  }
};
var Evidence_FromAmino = exports.Evidence_FromAmino = function Evidence_FromAmino(content) {
  return _any.Any.fromAmino(content);
};
var Evidence_ToAmino = exports.Evidence_ToAmino = function Evidence_ToAmino(content) {
  return _any.Any.toAmino(content);
};