UNPKG

@htdangkhoa/google-ads

Version:
912 lines (911 loc) 40.2 kB
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v1.181.2 // protoc v3.21.12 // source: google/ads/googleads/v24/resources/conversion_value_rule.proto /* eslint-disable */ import Long from "long"; import _m0 from "protobufjs/minimal.js"; import { conversionValueRuleStatusEnum_ConversionValueRuleStatusFromJSON, conversionValueRuleStatusEnum_ConversionValueRuleStatusToJSON, } from "../enums/conversion_value_rule_status.js"; import { valueRuleDeviceTypeEnum_ValueRuleDeviceTypeFromJSON, valueRuleDeviceTypeEnum_ValueRuleDeviceTypeToJSON, } from "../enums/value_rule_device_type.js"; import { valueRuleGeoLocationMatchTypeEnum_ValueRuleGeoLocationMatchTypeFromJSON, valueRuleGeoLocationMatchTypeEnum_ValueRuleGeoLocationMatchTypeToJSON, } from "../enums/value_rule_geo_location_match_type.js"; import { valueRuleOperationEnum_ValueRuleOperationFromJSON, valueRuleOperationEnum_ValueRuleOperationToJSON, } from "../enums/value_rule_operation.js"; function createBaseConversionValueRule() { return { resource_name: "", id: "0", action: undefined, geo_location_condition: undefined, device_condition: undefined, audience_condition: undefined, itinerary_condition: undefined, owner_customer: "", status: 0, }; } export const ConversionValueRule = { encode(message, writer = _m0.Writer.create()) { if (message.resource_name !== undefined && message.resource_name !== "") { writer.uint32(10).string(message.resource_name); } if (message.id !== undefined && message.id !== "0") { writer.uint32(16).int64(message.id); } if (message.action !== undefined) { ConversionValueRule_ValueRuleAction.encode(message.action, writer.uint32(26).fork()).ldelim(); } if (message.geo_location_condition !== undefined) { ConversionValueRule_ValueRuleGeoLocationCondition.encode(message.geo_location_condition, writer.uint32(34).fork()) .ldelim(); } if (message.device_condition !== undefined) { ConversionValueRule_ValueRuleDeviceCondition.encode(message.device_condition, writer.uint32(42).fork()).ldelim(); } if (message.audience_condition !== undefined) { ConversionValueRule_ValueRuleAudienceCondition.encode(message.audience_condition, writer.uint32(50).fork()) .ldelim(); } if (message.itinerary_condition !== undefined) { ConversionValueRule_ValueRuleItineraryCondition.encode(message.itinerary_condition, writer.uint32(74).fork()) .ldelim(); } if (message.owner_customer !== undefined && message.owner_customer !== "") { writer.uint32(58).string(message.owner_customer); } if (message.status !== undefined && message.status !== 0) { writer.uint32(64).int32(message.status); } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConversionValueRule(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.resource_name = reader.string(); continue; case 2: if (tag !== 16) { break; } message.id = longToString(reader.int64()); continue; case 3: if (tag !== 26) { break; } message.action = ConversionValueRule_ValueRuleAction.decode(reader, reader.uint32()); continue; case 4: if (tag !== 34) { break; } message.geo_location_condition = ConversionValueRule_ValueRuleGeoLocationCondition.decode(reader, reader.uint32()); continue; case 5: if (tag !== 42) { break; } message.device_condition = ConversionValueRule_ValueRuleDeviceCondition.decode(reader, reader.uint32()); continue; case 6: if (tag !== 50) { break; } message.audience_condition = ConversionValueRule_ValueRuleAudienceCondition.decode(reader, reader.uint32()); continue; case 9: if (tag !== 74) { break; } message.itinerary_condition = ConversionValueRule_ValueRuleItineraryCondition.decode(reader, reader.uint32()); continue; case 7: if (tag !== 58) { break; } message.owner_customer = reader.string(); continue; case 8: if (tag !== 64) { break; } message.status = reader.int32(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { resource_name: isSet(object.resource_name) ? globalThis.String(object.resource_name) : "", id: isSet(object.id) ? globalThis.String(object.id) : "0", action: isSet(object.action) ? ConversionValueRule_ValueRuleAction.fromJSON(object.action) : undefined, geo_location_condition: isSet(object.geo_location_condition) ? ConversionValueRule_ValueRuleGeoLocationCondition.fromJSON(object.geo_location_condition) : undefined, device_condition: isSet(object.device_condition) ? ConversionValueRule_ValueRuleDeviceCondition.fromJSON(object.device_condition) : undefined, audience_condition: isSet(object.audience_condition) ? ConversionValueRule_ValueRuleAudienceCondition.fromJSON(object.audience_condition) : undefined, itinerary_condition: isSet(object.itinerary_condition) ? ConversionValueRule_ValueRuleItineraryCondition.fromJSON(object.itinerary_condition) : undefined, owner_customer: isSet(object.owner_customer) ? globalThis.String(object.owner_customer) : "", status: isSet(object.status) ? conversionValueRuleStatusEnum_ConversionValueRuleStatusFromJSON(object.status) : 0, }; }, toJSON(message) { const obj = {}; if (message.resource_name !== undefined && message.resource_name !== "") { obj.resource_name = message.resource_name; } if (message.id !== undefined && message.id !== "0") { obj.id = message.id; } if (message.action !== undefined) { obj.action = ConversionValueRule_ValueRuleAction.toJSON(message.action); } if (message.geo_location_condition !== undefined) { obj.geo_location_condition = ConversionValueRule_ValueRuleGeoLocationCondition.toJSON(message.geo_location_condition); } if (message.device_condition !== undefined) { obj.device_condition = ConversionValueRule_ValueRuleDeviceCondition.toJSON(message.device_condition); } if (message.audience_condition !== undefined) { obj.audience_condition = ConversionValueRule_ValueRuleAudienceCondition.toJSON(message.audience_condition); } if (message.itinerary_condition !== undefined) { obj.itinerary_condition = ConversionValueRule_ValueRuleItineraryCondition.toJSON(message.itinerary_condition); } if (message.owner_customer !== undefined && message.owner_customer !== "") { obj.owner_customer = message.owner_customer; } if (message.status !== undefined && message.status !== 0) { obj.status = conversionValueRuleStatusEnum_ConversionValueRuleStatusToJSON(message.status); } return obj; }, create(base) { return ConversionValueRule.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d; const message = createBaseConversionValueRule(); message.resource_name = (_a = object.resource_name) !== null && _a !== void 0 ? _a : ""; message.id = (_b = object.id) !== null && _b !== void 0 ? _b : "0"; message.action = (object.action !== undefined && object.action !== null) ? ConversionValueRule_ValueRuleAction.fromPartial(object.action) : undefined; message.geo_location_condition = (object.geo_location_condition !== undefined && object.geo_location_condition !== null) ? ConversionValueRule_ValueRuleGeoLocationCondition.fromPartial(object.geo_location_condition) : undefined; message.device_condition = (object.device_condition !== undefined && object.device_condition !== null) ? ConversionValueRule_ValueRuleDeviceCondition.fromPartial(object.device_condition) : undefined; message.audience_condition = (object.audience_condition !== undefined && object.audience_condition !== null) ? ConversionValueRule_ValueRuleAudienceCondition.fromPartial(object.audience_condition) : undefined; message.itinerary_condition = (object.itinerary_condition !== undefined && object.itinerary_condition !== null) ? ConversionValueRule_ValueRuleItineraryCondition.fromPartial(object.itinerary_condition) : undefined; message.owner_customer = (_c = object.owner_customer) !== null && _c !== void 0 ? _c : ""; message.status = (_d = object.status) !== null && _d !== void 0 ? _d : 0; return message; }, }; function createBaseConversionValueRule_ValueRuleAction() { return { operation: 0, value: 0 }; } export const ConversionValueRule_ValueRuleAction = { encode(message, writer = _m0.Writer.create()) { if (message.operation !== undefined && message.operation !== 0) { writer.uint32(8).int32(message.operation); } if (message.value !== undefined && message.value !== 0) { writer.uint32(17).double(message.value); } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConversionValueRule_ValueRuleAction(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 8) { break; } message.operation = reader.int32(); continue; case 2: if (tag !== 17) { break; } message.value = reader.double(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { operation: isSet(object.operation) ? valueRuleOperationEnum_ValueRuleOperationFromJSON(object.operation) : 0, value: isSet(object.value) ? globalThis.Number(object.value) : 0, }; }, toJSON(message) { const obj = {}; if (message.operation !== undefined && message.operation !== 0) { obj.operation = valueRuleOperationEnum_ValueRuleOperationToJSON(message.operation); } if (message.value !== undefined && message.value !== 0) { obj.value = message.value; } return obj; }, create(base) { return ConversionValueRule_ValueRuleAction.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b; const message = createBaseConversionValueRule_ValueRuleAction(); message.operation = (_a = object.operation) !== null && _a !== void 0 ? _a : 0; message.value = (_b = object.value) !== null && _b !== void 0 ? _b : 0; return message; }, }; function createBaseConversionValueRule_ValueRuleGeoLocationCondition() { return { excluded_geo_target_constants: [], excluded_geo_match_type: 0, geo_target_constants: [], geo_match_type: 0 }; } export const ConversionValueRule_ValueRuleGeoLocationCondition = { encode(message, writer = _m0.Writer.create()) { if (message.excluded_geo_target_constants !== undefined && message.excluded_geo_target_constants.length !== 0) { for (const v of message.excluded_geo_target_constants) { writer.uint32(10).string(v); } } if (message.excluded_geo_match_type !== undefined && message.excluded_geo_match_type !== 0) { writer.uint32(16).int32(message.excluded_geo_match_type); } if (message.geo_target_constants !== undefined && message.geo_target_constants.length !== 0) { for (const v of message.geo_target_constants) { writer.uint32(26).string(v); } } if (message.geo_match_type !== undefined && message.geo_match_type !== 0) { writer.uint32(32).int32(message.geo_match_type); } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConversionValueRule_ValueRuleGeoLocationCondition(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.excluded_geo_target_constants.push(reader.string()); continue; case 2: if (tag !== 16) { break; } message.excluded_geo_match_type = reader.int32(); continue; case 3: if (tag !== 26) { break; } message.geo_target_constants.push(reader.string()); continue; case 4: if (tag !== 32) { break; } message.geo_match_type = reader.int32(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { excluded_geo_target_constants: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.excluded_geo_target_constants) ? object.excluded_geo_target_constants.map((e) => globalThis.String(e)) : [], excluded_geo_match_type: isSet(object.excluded_geo_match_type) ? valueRuleGeoLocationMatchTypeEnum_ValueRuleGeoLocationMatchTypeFromJSON(object.excluded_geo_match_type) : 0, geo_target_constants: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.geo_target_constants) ? object.geo_target_constants.map((e) => globalThis.String(e)) : [], geo_match_type: isSet(object.geo_match_type) ? valueRuleGeoLocationMatchTypeEnum_ValueRuleGeoLocationMatchTypeFromJSON(object.geo_match_type) : 0, }; }, toJSON(message) { var _a, _b; const obj = {}; if ((_a = message.excluded_geo_target_constants) === null || _a === void 0 ? void 0 : _a.length) { obj.excluded_geo_target_constants = message.excluded_geo_target_constants; } if (message.excluded_geo_match_type !== undefined && message.excluded_geo_match_type !== 0) { obj.excluded_geo_match_type = valueRuleGeoLocationMatchTypeEnum_ValueRuleGeoLocationMatchTypeToJSON(message.excluded_geo_match_type); } if ((_b = message.geo_target_constants) === null || _b === void 0 ? void 0 : _b.length) { obj.geo_target_constants = message.geo_target_constants; } if (message.geo_match_type !== undefined && message.geo_match_type !== 0) { obj.geo_match_type = valueRuleGeoLocationMatchTypeEnum_ValueRuleGeoLocationMatchTypeToJSON(message.geo_match_type); } return obj; }, create(base) { return ConversionValueRule_ValueRuleGeoLocationCondition.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d; const message = createBaseConversionValueRule_ValueRuleGeoLocationCondition(); message.excluded_geo_target_constants = ((_a = object.excluded_geo_target_constants) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; message.excluded_geo_match_type = (_b = object.excluded_geo_match_type) !== null && _b !== void 0 ? _b : 0; message.geo_target_constants = ((_c = object.geo_target_constants) === null || _c === void 0 ? void 0 : _c.map((e) => e)) || []; message.geo_match_type = (_d = object.geo_match_type) !== null && _d !== void 0 ? _d : 0; return message; }, }; function createBaseConversionValueRule_ValueRuleDeviceCondition() { return { device_types: [] }; } export const ConversionValueRule_ValueRuleDeviceCondition = { encode(message, writer = _m0.Writer.create()) { if (message.device_types !== undefined && message.device_types.length !== 0) { writer.uint32(10).fork(); for (const v of message.device_types) { writer.int32(v); } writer.ldelim(); } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConversionValueRule_ValueRuleDeviceCondition(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag === 8) { message.device_types.push(reader.int32()); continue; } if (tag === 10) { const end2 = reader.uint32() + reader.pos; while (reader.pos < end2) { message.device_types.push(reader.int32()); } continue; } break; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { device_types: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.device_types) ? object.device_types.map((e) => valueRuleDeviceTypeEnum_ValueRuleDeviceTypeFromJSON(e)) : [], }; }, toJSON(message) { var _a; const obj = {}; if ((_a = message.device_types) === null || _a === void 0 ? void 0 : _a.length) { obj.device_types = message.device_types.map((e) => valueRuleDeviceTypeEnum_ValueRuleDeviceTypeToJSON(e)); } return obj; }, create(base) { return ConversionValueRule_ValueRuleDeviceCondition.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a; const message = createBaseConversionValueRule_ValueRuleDeviceCondition(); message.device_types = ((_a = object.device_types) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; return message; }, }; function createBaseConversionValueRule_ValueRuleAudienceCondition() { return { user_lists: [], user_interests: [] }; } export const ConversionValueRule_ValueRuleAudienceCondition = { encode(message, writer = _m0.Writer.create()) { if (message.user_lists !== undefined && message.user_lists.length !== 0) { for (const v of message.user_lists) { writer.uint32(10).string(v); } } if (message.user_interests !== undefined && message.user_interests.length !== 0) { for (const v of message.user_interests) { writer.uint32(18).string(v); } } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConversionValueRule_ValueRuleAudienceCondition(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.user_lists.push(reader.string()); continue; case 2: if (tag !== 18) { break; } message.user_interests.push(reader.string()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { user_lists: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.user_lists) ? object.user_lists.map((e) => globalThis.String(e)) : [], user_interests: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.user_interests) ? object.user_interests.map((e) => globalThis.String(e)) : [], }; }, toJSON(message) { var _a, _b; const obj = {}; if ((_a = message.user_lists) === null || _a === void 0 ? void 0 : _a.length) { obj.user_lists = message.user_lists; } if ((_b = message.user_interests) === null || _b === void 0 ? void 0 : _b.length) { obj.user_interests = message.user_interests; } return obj; }, create(base) { return ConversionValueRule_ValueRuleAudienceCondition.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b; const message = createBaseConversionValueRule_ValueRuleAudienceCondition(); message.user_lists = ((_a = object.user_lists) === null || _a === void 0 ? void 0 : _a.map((e) => e)) || []; message.user_interests = ((_b = object.user_interests) === null || _b === void 0 ? void 0 : _b.map((e) => e)) || []; return message; }, }; function createBaseConversionValueRule_ValueRuleItineraryCondition() { return { advance_booking_window: undefined, travel_length: undefined, travel_start_day: undefined }; } export const ConversionValueRule_ValueRuleItineraryCondition = { encode(message, writer = _m0.Writer.create()) { if (message.advance_booking_window !== undefined) { ConversionValueRule_ValueRuleItineraryAdvanceBookingWindow.encode(message.advance_booking_window, writer.uint32(10).fork()).ldelim(); } if (message.travel_length !== undefined) { ConversionValueRule_ValueRuleItineraryTravelLength.encode(message.travel_length, writer.uint32(18).fork()) .ldelim(); } if (message.travel_start_day !== undefined) { ConversionValueRule_ValueRuleItineraryTravelStartDay.encode(message.travel_start_day, writer.uint32(26).fork()) .ldelim(); } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConversionValueRule_ValueRuleItineraryCondition(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.advance_booking_window = ConversionValueRule_ValueRuleItineraryAdvanceBookingWindow.decode(reader, reader.uint32()); continue; case 2: if (tag !== 18) { break; } message.travel_length = ConversionValueRule_ValueRuleItineraryTravelLength.decode(reader, reader.uint32()); continue; case 3: if (tag !== 26) { break; } message.travel_start_day = ConversionValueRule_ValueRuleItineraryTravelStartDay.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { advance_booking_window: isSet(object.advance_booking_window) ? ConversionValueRule_ValueRuleItineraryAdvanceBookingWindow.fromJSON(object.advance_booking_window) : undefined, travel_length: isSet(object.travel_length) ? ConversionValueRule_ValueRuleItineraryTravelLength.fromJSON(object.travel_length) : undefined, travel_start_day: isSet(object.travel_start_day) ? ConversionValueRule_ValueRuleItineraryTravelStartDay.fromJSON(object.travel_start_day) : undefined, }; }, toJSON(message) { const obj = {}; if (message.advance_booking_window !== undefined) { obj.advance_booking_window = ConversionValueRule_ValueRuleItineraryAdvanceBookingWindow.toJSON(message.advance_booking_window); } if (message.travel_length !== undefined) { obj.travel_length = ConversionValueRule_ValueRuleItineraryTravelLength.toJSON(message.travel_length); } if (message.travel_start_day !== undefined) { obj.travel_start_day = ConversionValueRule_ValueRuleItineraryTravelStartDay.toJSON(message.travel_start_day); } return obj; }, create(base) { return ConversionValueRule_ValueRuleItineraryCondition.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { const message = createBaseConversionValueRule_ValueRuleItineraryCondition(); message.advance_booking_window = (object.advance_booking_window !== undefined && object.advance_booking_window !== null) ? ConversionValueRule_ValueRuleItineraryAdvanceBookingWindow.fromPartial(object.advance_booking_window) : undefined; message.travel_length = (object.travel_length !== undefined && object.travel_length !== null) ? ConversionValueRule_ValueRuleItineraryTravelLength.fromPartial(object.travel_length) : undefined; message.travel_start_day = (object.travel_start_day !== undefined && object.travel_start_day !== null) ? ConversionValueRule_ValueRuleItineraryTravelStartDay.fromPartial(object.travel_start_day) : undefined; return message; }, }; function createBaseConversionValueRule_ValueRuleItineraryAdvanceBookingWindow() { return { min_days: undefined, max_days: undefined }; } export const ConversionValueRule_ValueRuleItineraryAdvanceBookingWindow = { encode(message, writer = _m0.Writer.create()) { if (message.min_days !== undefined) { writer.uint32(24).int32(message.min_days); } if (message.max_days !== undefined) { writer.uint32(32).int32(message.max_days); } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConversionValueRule_ValueRuleItineraryAdvanceBookingWindow(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 3: if (tag !== 24) { break; } message.min_days = reader.int32(); continue; case 4: if (tag !== 32) { break; } message.max_days = reader.int32(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { min_days: isSet(object.min_days) ? globalThis.Number(object.min_days) : undefined, max_days: isSet(object.max_days) ? globalThis.Number(object.max_days) : undefined, }; }, toJSON(message) { const obj = {}; if (message.min_days !== undefined) { obj.min_days = Math.round(message.min_days); } if (message.max_days !== undefined) { obj.max_days = Math.round(message.max_days); } return obj; }, create(base) { return ConversionValueRule_ValueRuleItineraryAdvanceBookingWindow.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b; const message = createBaseConversionValueRule_ValueRuleItineraryAdvanceBookingWindow(); message.min_days = (_a = object.min_days) !== null && _a !== void 0 ? _a : undefined; message.max_days = (_b = object.max_days) !== null && _b !== void 0 ? _b : undefined; return message; }, }; function createBaseConversionValueRule_ValueRuleItineraryTravelLength() { return { min_nights: 0, max_nights: 0 }; } export const ConversionValueRule_ValueRuleItineraryTravelLength = { encode(message, writer = _m0.Writer.create()) { if (message.min_nights !== undefined && message.min_nights !== 0) { writer.uint32(8).int32(message.min_nights); } if (message.max_nights !== undefined && message.max_nights !== 0) { writer.uint32(16).int32(message.max_nights); } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConversionValueRule_ValueRuleItineraryTravelLength(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 8) { break; } message.min_nights = reader.int32(); continue; case 2: if (tag !== 16) { break; } message.max_nights = reader.int32(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { min_nights: isSet(object.min_nights) ? globalThis.Number(object.min_nights) : 0, max_nights: isSet(object.max_nights) ? globalThis.Number(object.max_nights) : 0, }; }, toJSON(message) { const obj = {}; if (message.min_nights !== undefined && message.min_nights !== 0) { obj.min_nights = Math.round(message.min_nights); } if (message.max_nights !== undefined && message.max_nights !== 0) { obj.max_nights = Math.round(message.max_nights); } return obj; }, create(base) { return ConversionValueRule_ValueRuleItineraryTravelLength.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b; const message = createBaseConversionValueRule_ValueRuleItineraryTravelLength(); message.min_nights = (_a = object.min_nights) !== null && _a !== void 0 ? _a : 0; message.max_nights = (_b = object.max_nights) !== null && _b !== void 0 ? _b : 0; return message; }, }; function createBaseConversionValueRule_ValueRuleItineraryTravelStartDay() { return { monday: false, tuesday: false, wednesday: false, thursday: false, friday: false, saturday: false, sunday: false, }; } export const ConversionValueRule_ValueRuleItineraryTravelStartDay = { encode(message, writer = _m0.Writer.create()) { if (message.monday !== undefined && message.monday !== false) { writer.uint32(8).bool(message.monday); } if (message.tuesday !== undefined && message.tuesday !== false) { writer.uint32(16).bool(message.tuesday); } if (message.wednesday !== undefined && message.wednesday !== false) { writer.uint32(24).bool(message.wednesday); } if (message.thursday !== undefined && message.thursday !== false) { writer.uint32(32).bool(message.thursday); } if (message.friday !== undefined && message.friday !== false) { writer.uint32(40).bool(message.friday); } if (message.saturday !== undefined && message.saturday !== false) { writer.uint32(48).bool(message.saturday); } if (message.sunday !== undefined && message.sunday !== false) { writer.uint32(56).bool(message.sunday); } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConversionValueRule_ValueRuleItineraryTravelStartDay(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 8) { break; } message.monday = reader.bool(); continue; case 2: if (tag !== 16) { break; } message.tuesday = reader.bool(); continue; case 3: if (tag !== 24) { break; } message.wednesday = reader.bool(); continue; case 4: if (tag !== 32) { break; } message.thursday = reader.bool(); continue; case 5: if (tag !== 40) { break; } message.friday = reader.bool(); continue; case 6: if (tag !== 48) { break; } message.saturday = reader.bool(); continue; case 7: if (tag !== 56) { break; } message.sunday = reader.bool(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { monday: isSet(object.monday) ? globalThis.Boolean(object.monday) : false, tuesday: isSet(object.tuesday) ? globalThis.Boolean(object.tuesday) : false, wednesday: isSet(object.wednesday) ? globalThis.Boolean(object.wednesday) : false, thursday: isSet(object.thursday) ? globalThis.Boolean(object.thursday) : false, friday: isSet(object.friday) ? globalThis.Boolean(object.friday) : false, saturday: isSet(object.saturday) ? globalThis.Boolean(object.saturday) : false, sunday: isSet(object.sunday) ? globalThis.Boolean(object.sunday) : false, }; }, toJSON(message) { const obj = {}; if (message.monday !== undefined && message.monday !== false) { obj.monday = message.monday; } if (message.tuesday !== undefined && message.tuesday !== false) { obj.tuesday = message.tuesday; } if (message.wednesday !== undefined && message.wednesday !== false) { obj.wednesday = message.wednesday; } if (message.thursday !== undefined && message.thursday !== false) { obj.thursday = message.thursday; } if (message.friday !== undefined && message.friday !== false) { obj.friday = message.friday; } if (message.saturday !== undefined && message.saturday !== false) { obj.saturday = message.saturday; } if (message.sunday !== undefined && message.sunday !== false) { obj.sunday = message.sunday; } return obj; }, create(base) { return ConversionValueRule_ValueRuleItineraryTravelStartDay.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e, _f, _g; const message = createBaseConversionValueRule_ValueRuleItineraryTravelStartDay(); message.monday = (_a = object.monday) !== null && _a !== void 0 ? _a : false; message.tuesday = (_b = object.tuesday) !== null && _b !== void 0 ? _b : false; message.wednesday = (_c = object.wednesday) !== null && _c !== void 0 ? _c : false; message.thursday = (_d = object.thursday) !== null && _d !== void 0 ? _d : false; message.friday = (_e = object.friday) !== null && _e !== void 0 ? _e : false; message.saturday = (_f = object.saturday) !== null && _f !== void 0 ? _f : false; message.sunday = (_g = object.sunday) !== null && _g !== void 0 ? _g : false; return message; }, }; function longToString(long) { return long.toString(); } if (_m0.util.Long !== Long) { _m0.util.Long = Long; _m0.configure(); } function isSet(value) { return value !== null && value !== undefined; }