import * as _m0 from "protobufjs/minimal";
function createBaseCreateSpotLimitOrderAuthz() {
  return {
    subaccountId: "",
    marketIds: []
  };
}
export const CreateSpotLimitOrderAuthz = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.subaccountId !== "") {
      writer.uint32(10).string(message.subaccountId);
    }
    for (const v of message.marketIds) {
      writer.uint32(18).string(v);
    }
    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 = createBaseCreateSpotLimitOrderAuthz();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.subaccountId = reader.string();
          break;
        case 2:
          message.marketIds.push(reader.string());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$subaccountId, _object$marketIds;
    const message = createBaseCreateSpotLimitOrderAuthz();
    message.subaccountId = (_object$subaccountId = object.subaccountId) !== null && _object$subaccountId !== void 0 ? _object$subaccountId : "";
    message.marketIds = ((_object$marketIds = object.marketIds) === null || _object$marketIds === void 0 ? void 0 : _object$marketIds.map(e => e)) || [];
    return message;
  }
};
function createBaseCreateSpotMarketOrderAuthz() {
  return {
    subaccountId: "",
    marketIds: []
  };
}
export const CreateSpotMarketOrderAuthz = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.subaccountId !== "") {
      writer.uint32(10).string(message.subaccountId);
    }
    for (const v of message.marketIds) {
      writer.uint32(18).string(v);
    }
    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 = createBaseCreateSpotMarketOrderAuthz();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.subaccountId = reader.string();
          break;
        case 2:
          message.marketIds.push(reader.string());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$subaccountId2, _object$marketIds2;
    const message = createBaseCreateSpotMarketOrderAuthz();
    message.subaccountId = (_object$subaccountId2 = object.subaccountId) !== null && _object$subaccountId2 !== void 0 ? _object$subaccountId2 : "";
    message.marketIds = ((_object$marketIds2 = object.marketIds) === null || _object$marketIds2 === void 0 ? void 0 : _object$marketIds2.map(e => e)) || [];
    return message;
  }
};
function createBaseBatchCreateSpotLimitOrdersAuthz() {
  return {
    subaccountId: "",
    marketIds: []
  };
}
export const BatchCreateSpotLimitOrdersAuthz = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.subaccountId !== "") {
      writer.uint32(10).string(message.subaccountId);
    }
    for (const v of message.marketIds) {
      writer.uint32(18).string(v);
    }
    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 = createBaseBatchCreateSpotLimitOrdersAuthz();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.subaccountId = reader.string();
          break;
        case 2:
          message.marketIds.push(reader.string());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$subaccountId3, _object$marketIds3;
    const message = createBaseBatchCreateSpotLimitOrdersAuthz();
    message.subaccountId = (_object$subaccountId3 = object.subaccountId) !== null && _object$subaccountId3 !== void 0 ? _object$subaccountId3 : "";
    message.marketIds = ((_object$marketIds3 = object.marketIds) === null || _object$marketIds3 === void 0 ? void 0 : _object$marketIds3.map(e => e)) || [];
    return message;
  }
};
function createBaseCancelSpotOrderAuthz() {
  return {
    subaccountId: "",
    marketIds: []
  };
}
export const CancelSpotOrderAuthz = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.subaccountId !== "") {
      writer.uint32(10).string(message.subaccountId);
    }
    for (const v of message.marketIds) {
      writer.uint32(18).string(v);
    }
    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 = createBaseCancelSpotOrderAuthz();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.subaccountId = reader.string();
          break;
        case 2:
          message.marketIds.push(reader.string());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$subaccountId4, _object$marketIds4;
    const message = createBaseCancelSpotOrderAuthz();
    message.subaccountId = (_object$subaccountId4 = object.subaccountId) !== null && _object$subaccountId4 !== void 0 ? _object$subaccountId4 : "";
    message.marketIds = ((_object$marketIds4 = object.marketIds) === null || _object$marketIds4 === void 0 ? void 0 : _object$marketIds4.map(e => e)) || [];
    return message;
  }
};
function createBaseBatchCancelSpotOrdersAuthz() {
  return {
    subaccountId: "",
    marketIds: []
  };
}
export const BatchCancelSpotOrdersAuthz = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.subaccountId !== "") {
      writer.uint32(10).string(message.subaccountId);
    }
    for (const v of message.marketIds) {
      writer.uint32(18).string(v);
    }
    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 = createBaseBatchCancelSpotOrdersAuthz();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.subaccountId = reader.string();
          break;
        case 2:
          message.marketIds.push(reader.string());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$subaccountId5, _object$marketIds5;
    const message = createBaseBatchCancelSpotOrdersAuthz();
    message.subaccountId = (_object$subaccountId5 = object.subaccountId) !== null && _object$subaccountId5 !== void 0 ? _object$subaccountId5 : "";
    message.marketIds = ((_object$marketIds5 = object.marketIds) === null || _object$marketIds5 === void 0 ? void 0 : _object$marketIds5.map(e => e)) || [];
    return message;
  }
};
function createBaseCreateDerivativeLimitOrderAuthz() {
  return {
    subaccountId: "",
    marketIds: []
  };
}
export const CreateDerivativeLimitOrderAuthz = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.subaccountId !== "") {
      writer.uint32(10).string(message.subaccountId);
    }
    for (const v of message.marketIds) {
      writer.uint32(18).string(v);
    }
    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 = createBaseCreateDerivativeLimitOrderAuthz();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.subaccountId = reader.string();
          break;
        case 2:
          message.marketIds.push(reader.string());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$subaccountId6, _object$marketIds6;
    const message = createBaseCreateDerivativeLimitOrderAuthz();
    message.subaccountId = (_object$subaccountId6 = object.subaccountId) !== null && _object$subaccountId6 !== void 0 ? _object$subaccountId6 : "";
    message.marketIds = ((_object$marketIds6 = object.marketIds) === null || _object$marketIds6 === void 0 ? void 0 : _object$marketIds6.map(e => e)) || [];
    return message;
  }
};
function createBaseCreateDerivativeMarketOrderAuthz() {
  return {
    subaccountId: "",
    marketIds: []
  };
}
export const CreateDerivativeMarketOrderAuthz = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.subaccountId !== "") {
      writer.uint32(10).string(message.subaccountId);
    }
    for (const v of message.marketIds) {
      writer.uint32(18).string(v);
    }
    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 = createBaseCreateDerivativeMarketOrderAuthz();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.subaccountId = reader.string();
          break;
        case 2:
          message.marketIds.push(reader.string());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$subaccountId7, _object$marketIds7;
    const message = createBaseCreateDerivativeMarketOrderAuthz();
    message.subaccountId = (_object$subaccountId7 = object.subaccountId) !== null && _object$subaccountId7 !== void 0 ? _object$subaccountId7 : "";
    message.marketIds = ((_object$marketIds7 = object.marketIds) === null || _object$marketIds7 === void 0 ? void 0 : _object$marketIds7.map(e => e)) || [];
    return message;
  }
};
function createBaseBatchCreateDerivativeLimitOrdersAuthz() {
  return {
    subaccountId: "",
    marketIds: []
  };
}
export const BatchCreateDerivativeLimitOrdersAuthz = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.subaccountId !== "") {
      writer.uint32(10).string(message.subaccountId);
    }
    for (const v of message.marketIds) {
      writer.uint32(18).string(v);
    }
    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 = createBaseBatchCreateDerivativeLimitOrdersAuthz();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.subaccountId = reader.string();
          break;
        case 2:
          message.marketIds.push(reader.string());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$subaccountId8, _object$marketIds8;
    const message = createBaseBatchCreateDerivativeLimitOrdersAuthz();
    message.subaccountId = (_object$subaccountId8 = object.subaccountId) !== null && _object$subaccountId8 !== void 0 ? _object$subaccountId8 : "";
    message.marketIds = ((_object$marketIds8 = object.marketIds) === null || _object$marketIds8 === void 0 ? void 0 : _object$marketIds8.map(e => e)) || [];
    return message;
  }
};
function createBaseCancelDerivativeOrderAuthz() {
  return {
    subaccountId: "",
    marketIds: []
  };
}
export const CancelDerivativeOrderAuthz = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.subaccountId !== "") {
      writer.uint32(10).string(message.subaccountId);
    }
    for (const v of message.marketIds) {
      writer.uint32(18).string(v);
    }
    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 = createBaseCancelDerivativeOrderAuthz();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.subaccountId = reader.string();
          break;
        case 2:
          message.marketIds.push(reader.string());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$subaccountId9, _object$marketIds9;
    const message = createBaseCancelDerivativeOrderAuthz();
    message.subaccountId = (_object$subaccountId9 = object.subaccountId) !== null && _object$subaccountId9 !== void 0 ? _object$subaccountId9 : "";
    message.marketIds = ((_object$marketIds9 = object.marketIds) === null || _object$marketIds9 === void 0 ? void 0 : _object$marketIds9.map(e => e)) || [];
    return message;
  }
};
function createBaseBatchCancelDerivativeOrdersAuthz() {
  return {
    subaccountId: "",
    marketIds: []
  };
}
export const BatchCancelDerivativeOrdersAuthz = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.subaccountId !== "") {
      writer.uint32(10).string(message.subaccountId);
    }
    for (const v of message.marketIds) {
      writer.uint32(18).string(v);
    }
    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 = createBaseBatchCancelDerivativeOrdersAuthz();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.subaccountId = reader.string();
          break;
        case 2:
          message.marketIds.push(reader.string());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$subaccountId10, _object$marketIds10;
    const message = createBaseBatchCancelDerivativeOrdersAuthz();
    message.subaccountId = (_object$subaccountId10 = object.subaccountId) !== null && _object$subaccountId10 !== void 0 ? _object$subaccountId10 : "";
    message.marketIds = ((_object$marketIds10 = object.marketIds) === null || _object$marketIds10 === void 0 ? void 0 : _object$marketIds10.map(e => e)) || [];
    return message;
  }
};
function createBaseBatchUpdateOrdersAuthz() {
  return {
    subaccountId: "",
    spotMarkets: [],
    derivativeMarkets: []
  };
}
export const BatchUpdateOrdersAuthz = {
  encode(message, writer = _m0.Writer.create()) {
    if (message.subaccountId !== "") {
      writer.uint32(10).string(message.subaccountId);
    }
    for (const v of message.spotMarkets) {
      writer.uint32(18).string(v);
    }
    for (const v of message.derivativeMarkets) {
      writer.uint32(26).string(v);
    }
    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 = createBaseBatchUpdateOrdersAuthz();
    while (reader.pos < end) {
      const tag = reader.uint32();
      switch (tag >>> 3) {
        case 1:
          message.subaccountId = reader.string();
          break;
        case 2:
          message.spotMarkets.push(reader.string());
          break;
        case 3:
          message.derivativeMarkets.push(reader.string());
          break;
        default:
          reader.skipType(tag & 7);
          break;
      }
    }
    return message;
  },
  fromPartial(object) {
    var _object$subaccountId11, _object$spotMarkets, _object$derivativeMar;
    const message = createBaseBatchUpdateOrdersAuthz();
    message.subaccountId = (_object$subaccountId11 = object.subaccountId) !== null && _object$subaccountId11 !== void 0 ? _object$subaccountId11 : "";
    message.spotMarkets = ((_object$spotMarkets = object.spotMarkets) === null || _object$spotMarkets === void 0 ? void 0 : _object$spotMarkets.map(e => e)) || [];
    message.derivativeMarkets = ((_object$derivativeMar = object.derivativeMarkets) === null || _object$derivativeMar === void 0 ? void 0 : _object$derivativeMar.map(e => e)) || [];
    return message;
  }
};