import { Long } from "../../../helpers";
import * as _m0 from "protobufjs/minimal";
function createBaseSetChainlinkPriceEvent() {
  return {
    feedId: "",
    answer: "",
    timestamp: Long.UZERO
  };
}
export const SetChainlinkPriceEvent = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.feedId !== "") {
      writer.uint32(10).string(message.feedId);
    }
    if (message.answer !== "") {
      writer.uint32(18).string(message.answer);
    }
    if (!message.timestamp.isZero()) {
      writer.uint32(24).uint64(message.timestamp);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseSetChainlinkPriceEvent();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.feedId = reader.string();
          break;
        case 2:
          message.answer = reader.string();
          break;
        case 3:
          message.timestamp = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$feedId, _object$answer;
    const message = createBaseSetChainlinkPriceEvent();
    message.feedId = (_object$feedId = object.feedId) !== null && _object$feedId !== void 0 ? _object$feedId : "";
    message.answer = (_object$answer = object.answer) !== null && _object$answer !== void 0 ? _object$answer : "";
    message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? Long.fromValue(object.timestamp) : Long.UZERO;
    return message;
  }
};
function createBaseSetBandPriceEvent() {
  return {
    relayer: "",
    symbol: "",
    price: "",
    resolveTime: Long.UZERO,
    requestId: Long.UZERO
  };
}
export const SetBandPriceEvent = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.relayer !== "") {
      writer.uint32(10).string(message.relayer);
    }
    if (message.symbol !== "") {
      writer.uint32(18).string(message.symbol);
    }
    if (message.price !== "") {
      writer.uint32(26).string(message.price);
    }
    if (!message.resolveTime.isZero()) {
      writer.uint32(32).uint64(message.resolveTime);
    }
    if (!message.requestId.isZero()) {
      writer.uint32(40).uint64(message.requestId);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseSetBandPriceEvent();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.relayer = reader.string();
          break;
        case 2:
          message.symbol = reader.string();
          break;
        case 3:
          message.price = reader.string();
          break;
        case 4:
          message.resolveTime = reader.uint64();
          break;
        case 5:
          message.requestId = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$relayer, _object$symbol, _object$price;
    const message = createBaseSetBandPriceEvent();
    message.relayer = (_object$relayer = object.relayer) !== null && _object$relayer !== void 0 ? _object$relayer : "";
    message.symbol = (_object$symbol = object.symbol) !== null && _object$symbol !== void 0 ? _object$symbol : "";
    message.price = (_object$price = object.price) !== null && _object$price !== void 0 ? _object$price : "";
    message.resolveTime = object.resolveTime !== undefined && object.resolveTime !== null ? Long.fromValue(object.resolveTime) : Long.UZERO;
    message.requestId = object.requestId !== undefined && object.requestId !== null ? Long.fromValue(object.requestId) : Long.UZERO;
    return message;
  }
};
function createBaseSetBandIBCPriceEvent() {
  return {
    relayer: "",
    symbols: [],
    prices: [],
    resolveTime: Long.UZERO,
    requestId: Long.UZERO,
    clientId: Long.ZERO
  };
}
export const SetBandIBCPriceEvent = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.relayer !== "") {
      writer.uint32(10).string(message.relayer);
    }
    for (const v of message.symbols) {
      writer.uint32(18).string(v);
    }
    for (const v of message.prices) {
      writer.uint32(26).string(v);
    }
    if (!message.resolveTime.isZero()) {
      writer.uint32(32).uint64(message.resolveTime);
    }
    if (!message.requestId.isZero()) {
      writer.uint32(40).uint64(message.requestId);
    }
    if (!message.clientId.isZero()) {
      writer.uint32(48).int64(message.clientId);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseSetBandIBCPriceEvent();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.relayer = reader.string();
          break;
        case 2:
          message.symbols.push(reader.string());
          break;
        case 3:
          message.prices.push(reader.string());
          break;
        case 4:
          message.resolveTime = reader.uint64();
          break;
        case 5:
          message.requestId = reader.uint64();
          break;
        case 6:
          message.clientId = reader.int64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$relayer2, _object$symbols, _object$prices;
    const message = createBaseSetBandIBCPriceEvent();
    message.relayer = (_object$relayer2 = object.relayer) !== null && _object$relayer2 !== void 0 ? _object$relayer2 : "";
    message.symbols = ((_object$symbols = object.symbols) === null || _object$symbols === void 0 ? void 0 : _object$symbols.map(e => e)) || [];
    message.prices = ((_object$prices = object.prices) === null || _object$prices === void 0 ? void 0 : _object$prices.map(e => e)) || [];
    message.resolveTime = object.resolveTime !== undefined && object.resolveTime !== null ? Long.fromValue(object.resolveTime) : Long.UZERO;
    message.requestId = object.requestId !== undefined && object.requestId !== null ? Long.fromValue(object.requestId) : Long.UZERO;
    message.clientId = object.clientId !== undefined && object.clientId !== null ? Long.fromValue(object.clientId) : Long.ZERO;
    return message;
  }
};
function createBaseEventBandIBCAckSuccess() {
  return {
    ackResult: "",
    clientId: Long.ZERO
  };
}
export const EventBandIBCAckSuccess = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.ackResult !== "") {
      writer.uint32(10).string(message.ackResult);
    }
    if (!message.clientId.isZero()) {
      writer.uint32(16).int64(message.clientId);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseEventBandIBCAckSuccess();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.ackResult = reader.string();
          break;
        case 2:
          message.clientId = reader.int64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$ackResult;
    const message = createBaseEventBandIBCAckSuccess();
    message.ackResult = (_object$ackResult = object.ackResult) !== null && _object$ackResult !== void 0 ? _object$ackResult : "";
    message.clientId = object.clientId !== undefined && object.clientId !== null ? Long.fromValue(object.clientId) : Long.ZERO;
    return message;
  }
};
function createBaseEventBandIBCAckError() {
  return {
    ackError: "",
    clientId: Long.ZERO
  };
}
export const EventBandIBCAckError = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.ackError !== "") {
      writer.uint32(10).string(message.ackError);
    }
    if (!message.clientId.isZero()) {
      writer.uint32(16).int64(message.clientId);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseEventBandIBCAckError();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.ackError = reader.string();
          break;
        case 2:
          message.clientId = reader.int64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$ackError;
    const message = createBaseEventBandIBCAckError();
    message.ackError = (_object$ackError = object.ackError) !== null && _object$ackError !== void 0 ? _object$ackError : "";
    message.clientId = object.clientId !== undefined && object.clientId !== null ? Long.fromValue(object.clientId) : Long.ZERO;
    return message;
  }
};
function createBaseEventBandIBCResponseTimeout() {
  return {
    clientId: Long.ZERO
  };
}
export const EventBandIBCResponseTimeout = {
  encode(message, writer = _m0.Writer.create()) {
    if (!message.clientId.isZero()) {
      writer.uint32(8).int64(message.clientId);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseEventBandIBCResponseTimeout();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.clientId = reader.int64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    const message = createBaseEventBandIBCResponseTimeout();
    message.clientId = object.clientId !== undefined && object.clientId !== null ? Long.fromValue(object.clientId) : Long.ZERO;
    return message;
  }
};
function createBaseSetPriceFeedPriceEvent() {
  return {
    relayer: "",
    base: "",
    quote: "",
    price: ""
  };
}
export const SetPriceFeedPriceEvent = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.relayer !== "") {
      writer.uint32(10).string(message.relayer);
    }
    if (message.base !== "") {
      writer.uint32(18).string(message.base);
    }
    if (message.quote !== "") {
      writer.uint32(26).string(message.quote);
    }
    if (message.price !== "") {
      writer.uint32(34).string(message.price);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseSetPriceFeedPriceEvent();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.relayer = reader.string();
          break;
        case 2:
          message.base = reader.string();
          break;
        case 3:
          message.quote = reader.string();
          break;
        case 4:
          message.price = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$relayer3, _object$base, _object$quote, _object$price2;
    const message = createBaseSetPriceFeedPriceEvent();
    message.relayer = (_object$relayer3 = object.relayer) !== null && _object$relayer3 !== void 0 ? _object$relayer3 : "";
    message.base = (_object$base = object.base) !== null && _object$base !== void 0 ? _object$base : "";
    message.quote = (_object$quote = object.quote) !== null && _object$quote !== void 0 ? _object$quote : "";
    message.price = (_object$price2 = object.price) !== null && _object$price2 !== void 0 ? _object$price2 : "";
    return message;
  }
};
function createBaseSetProviderPriceEvent() {
  return {
    provider: "",
    relayer: "",
    symbol: "",
    price: ""
  };
}
export const SetProviderPriceEvent = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.provider !== "") {
      writer.uint32(10).string(message.provider);
    }
    if (message.relayer !== "") {
      writer.uint32(18).string(message.relayer);
    }
    if (message.symbol !== "") {
      writer.uint32(26).string(message.symbol);
    }
    if (message.price !== "") {
      writer.uint32(34).string(message.price);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseSetProviderPriceEvent();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.provider = reader.string();
          break;
        case 2:
          message.relayer = reader.string();
          break;
        case 3:
          message.symbol = reader.string();
          break;
        case 4:
          message.price = reader.string();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$provider, _object$relayer4, _object$symbol2, _object$price3;
    const message = createBaseSetProviderPriceEvent();
    message.provider = (_object$provider = object.provider) !== null && _object$provider !== void 0 ? _object$provider : "";
    message.relayer = (_object$relayer4 = object.relayer) !== null && _object$relayer4 !== void 0 ? _object$relayer4 : "";
    message.symbol = (_object$symbol2 = object.symbol) !== null && _object$symbol2 !== void 0 ? _object$symbol2 : "";
    message.price = (_object$price3 = object.price) !== null && _object$price3 !== void 0 ? _object$price3 : "";
    return message;
  }
};
function createBaseSetCoinbasePriceEvent() {
  return {
    symbol: "",
    price: "",
    timestamp: Long.UZERO
  };
}
export const SetCoinbasePriceEvent = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.symbol !== "") {
      writer.uint32(10).string(message.symbol);
    }
    if (message.price !== "") {
      writer.uint32(18).string(message.price);
    }
    if (!message.timestamp.isZero()) {
      writer.uint32(24).uint64(message.timestamp);
    }
    return writer;
  },
  decode(input, length) {
    const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
    let end = length === undefined ? reader.len : reader.pos + length;
    const message = createBaseSetCoinbasePriceEvent();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.symbol = reader.string();
          break;
        case 2:
          message.price = reader.string();
          break;
        case 3:
          message.timestamp = reader.uint64();
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$symbol3, _object$price4;
    const message = createBaseSetCoinbasePriceEvent();
    message.symbol = (_object$symbol3 = object.symbol) !== null && _object$symbol3 !== void 0 ? _object$symbol3 : "";
    message.price = (_object$price4 = object.price) !== null && _object$price4 !== void 0 ? _object$price4 : "";
    message.timestamp = object.timestamp !== undefined && object.timestamp !== null ? Long.fromValue(object.timestamp) : Long.UZERO;
    return message;
  }
};