UNPKG

@htdangkhoa/google-ads

Version:
1,187 lines 61.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/common/offline_user_data.proto /* eslint-disable */ import Long from "long"; import _m0 from "protobufjs/minimal.js"; import { userIdentifierSourceEnum_UserIdentifierSourceFromJSON, userIdentifierSourceEnum_UserIdentifierSourceToJSON, } from "../enums/user_identifier_source.js"; import { Consent } from "./consent.js"; function createBaseOfflineUserAddressInfo() { return { hashed_first_name: undefined, hashed_last_name: undefined, city: undefined, state: undefined, country_code: undefined, postal_code: undefined, hashed_street_address: undefined, }; } export const OfflineUserAddressInfo = { encode(message, writer = _m0.Writer.create()) { if (message.hashed_first_name !== undefined) { writer.uint32(58).string(message.hashed_first_name); } if (message.hashed_last_name !== undefined) { writer.uint32(66).string(message.hashed_last_name); } if (message.city !== undefined) { writer.uint32(74).string(message.city); } if (message.state !== undefined) { writer.uint32(82).string(message.state); } if (message.country_code !== undefined) { writer.uint32(90).string(message.country_code); } if (message.postal_code !== undefined) { writer.uint32(98).string(message.postal_code); } if (message.hashed_street_address !== undefined) { writer.uint32(106).string(message.hashed_street_address); } 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 = createBaseOfflineUserAddressInfo(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 7: if (tag !== 58) { break; } message.hashed_first_name = reader.string(); continue; case 8: if (tag !== 66) { break; } message.hashed_last_name = reader.string(); continue; case 9: if (tag !== 74) { break; } message.city = reader.string(); continue; case 10: if (tag !== 82) { break; } message.state = reader.string(); continue; case 11: if (tag !== 90) { break; } message.country_code = reader.string(); continue; case 12: if (tag !== 98) { break; } message.postal_code = reader.string(); continue; case 13: if (tag !== 106) { break; } message.hashed_street_address = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { hashed_first_name: isSet(object.hashed_first_name) ? globalThis.String(object.hashed_first_name) : undefined, hashed_last_name: isSet(object.hashed_last_name) ? globalThis.String(object.hashed_last_name) : undefined, city: isSet(object.city) ? globalThis.String(object.city) : undefined, state: isSet(object.state) ? globalThis.String(object.state) : undefined, country_code: isSet(object.country_code) ? globalThis.String(object.country_code) : undefined, postal_code: isSet(object.postal_code) ? globalThis.String(object.postal_code) : undefined, hashed_street_address: isSet(object.hashed_street_address) ? globalThis.String(object.hashed_street_address) : undefined, }; }, toJSON(message) { const obj = {}; if (message.hashed_first_name !== undefined) { obj.hashed_first_name = message.hashed_first_name; } if (message.hashed_last_name !== undefined) { obj.hashed_last_name = message.hashed_last_name; } if (message.city !== undefined) { obj.city = message.city; } if (message.state !== undefined) { obj.state = message.state; } if (message.country_code !== undefined) { obj.country_code = message.country_code; } if (message.postal_code !== undefined) { obj.postal_code = message.postal_code; } if (message.hashed_street_address !== undefined) { obj.hashed_street_address = message.hashed_street_address; } return obj; }, create(base) { return OfflineUserAddressInfo.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e, _f, _g; const message = createBaseOfflineUserAddressInfo(); message.hashed_first_name = (_a = object.hashed_first_name) !== null && _a !== void 0 ? _a : undefined; message.hashed_last_name = (_b = object.hashed_last_name) !== null && _b !== void 0 ? _b : undefined; message.city = (_c = object.city) !== null && _c !== void 0 ? _c : undefined; message.state = (_d = object.state) !== null && _d !== void 0 ? _d : undefined; message.country_code = (_e = object.country_code) !== null && _e !== void 0 ? _e : undefined; message.postal_code = (_f = object.postal_code) !== null && _f !== void 0 ? _f : undefined; message.hashed_street_address = (_g = object.hashed_street_address) !== null && _g !== void 0 ? _g : undefined; return message; }, }; function createBaseUserIdentifier() { return { user_identifier_source: 0, hashed_email: undefined, hashed_phone_number: undefined, mobile_id: undefined, third_party_user_id: undefined, address_info: undefined, }; } export const UserIdentifier = { encode(message, writer = _m0.Writer.create()) { if (message.user_identifier_source !== undefined && message.user_identifier_source !== 0) { writer.uint32(48).int32(message.user_identifier_source); } if (message.hashed_email !== undefined) { writer.uint32(58).string(message.hashed_email); } if (message.hashed_phone_number !== undefined) { writer.uint32(66).string(message.hashed_phone_number); } if (message.mobile_id !== undefined) { writer.uint32(74).string(message.mobile_id); } if (message.third_party_user_id !== undefined) { writer.uint32(82).string(message.third_party_user_id); } if (message.address_info !== undefined) { OfflineUserAddressInfo.encode(message.address_info, writer.uint32(42).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 = createBaseUserIdentifier(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 6: if (tag !== 48) { break; } message.user_identifier_source = reader.int32(); continue; case 7: if (tag !== 58) { break; } message.hashed_email = reader.string(); continue; case 8: if (tag !== 66) { break; } message.hashed_phone_number = reader.string(); continue; case 9: if (tag !== 74) { break; } message.mobile_id = reader.string(); continue; case 10: if (tag !== 82) { break; } message.third_party_user_id = reader.string(); continue; case 5: if (tag !== 42) { break; } message.address_info = OfflineUserAddressInfo.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { user_identifier_source: isSet(object.user_identifier_source) ? userIdentifierSourceEnum_UserIdentifierSourceFromJSON(object.user_identifier_source) : 0, hashed_email: isSet(object.hashed_email) ? globalThis.String(object.hashed_email) : undefined, hashed_phone_number: isSet(object.hashed_phone_number) ? globalThis.String(object.hashed_phone_number) : undefined, mobile_id: isSet(object.mobile_id) ? globalThis.String(object.mobile_id) : undefined, third_party_user_id: isSet(object.third_party_user_id) ? globalThis.String(object.third_party_user_id) : undefined, address_info: isSet(object.address_info) ? OfflineUserAddressInfo.fromJSON(object.address_info) : undefined, }; }, toJSON(message) { const obj = {}; if (message.user_identifier_source !== undefined && message.user_identifier_source !== 0) { obj.user_identifier_source = userIdentifierSourceEnum_UserIdentifierSourceToJSON(message.user_identifier_source); } if (message.hashed_email !== undefined) { obj.hashed_email = message.hashed_email; } if (message.hashed_phone_number !== undefined) { obj.hashed_phone_number = message.hashed_phone_number; } if (message.mobile_id !== undefined) { obj.mobile_id = message.mobile_id; } if (message.third_party_user_id !== undefined) { obj.third_party_user_id = message.third_party_user_id; } if (message.address_info !== undefined) { obj.address_info = OfflineUserAddressInfo.toJSON(message.address_info); } return obj; }, create(base) { return UserIdentifier.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e; const message = createBaseUserIdentifier(); message.user_identifier_source = (_a = object.user_identifier_source) !== null && _a !== void 0 ? _a : 0; message.hashed_email = (_b = object.hashed_email) !== null && _b !== void 0 ? _b : undefined; message.hashed_phone_number = (_c = object.hashed_phone_number) !== null && _c !== void 0 ? _c : undefined; message.mobile_id = (_d = object.mobile_id) !== null && _d !== void 0 ? _d : undefined; message.third_party_user_id = (_e = object.third_party_user_id) !== null && _e !== void 0 ? _e : undefined; message.address_info = (object.address_info !== undefined && object.address_info !== null) ? OfflineUserAddressInfo.fromPartial(object.address_info) : undefined; return message; }, }; function createBaseTransactionAttribute() { return { transaction_date_time: undefined, transaction_amount_micros: undefined, currency_code: undefined, conversion_action: undefined, order_id: undefined, store_attribute: undefined, custom_value: undefined, item_attribute: undefined, }; } export const TransactionAttribute = { encode(message, writer = _m0.Writer.create()) { if (message.transaction_date_time !== undefined) { writer.uint32(66).string(message.transaction_date_time); } if (message.transaction_amount_micros !== undefined) { writer.uint32(73).double(message.transaction_amount_micros); } if (message.currency_code !== undefined) { writer.uint32(82).string(message.currency_code); } if (message.conversion_action !== undefined) { writer.uint32(90).string(message.conversion_action); } if (message.order_id !== undefined) { writer.uint32(98).string(message.order_id); } if (message.store_attribute !== undefined) { StoreAttribute.encode(message.store_attribute, writer.uint32(50).fork()).ldelim(); } if (message.custom_value !== undefined) { writer.uint32(106).string(message.custom_value); } if (message.item_attribute !== undefined) { ItemAttribute.encode(message.item_attribute, writer.uint32(114).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 = createBaseTransactionAttribute(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 8: if (tag !== 66) { break; } message.transaction_date_time = reader.string(); continue; case 9: if (tag !== 73) { break; } message.transaction_amount_micros = reader.double(); continue; case 10: if (tag !== 82) { break; } message.currency_code = reader.string(); continue; case 11: if (tag !== 90) { break; } message.conversion_action = reader.string(); continue; case 12: if (tag !== 98) { break; } message.order_id = reader.string(); continue; case 6: if (tag !== 50) { break; } message.store_attribute = StoreAttribute.decode(reader, reader.uint32()); continue; case 13: if (tag !== 106) { break; } message.custom_value = reader.string(); continue; case 14: if (tag !== 114) { break; } message.item_attribute = ItemAttribute.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { transaction_date_time: isSet(object.transaction_date_time) ? globalThis.String(object.transaction_date_time) : undefined, transaction_amount_micros: isSet(object.transaction_amount_micros) ? globalThis.Number(object.transaction_amount_micros) : undefined, currency_code: isSet(object.currency_code) ? globalThis.String(object.currency_code) : undefined, conversion_action: isSet(object.conversion_action) ? globalThis.String(object.conversion_action) : undefined, order_id: isSet(object.order_id) ? globalThis.String(object.order_id) : undefined, store_attribute: isSet(object.store_attribute) ? StoreAttribute.fromJSON(object.store_attribute) : undefined, custom_value: isSet(object.custom_value) ? globalThis.String(object.custom_value) : undefined, item_attribute: isSet(object.item_attribute) ? ItemAttribute.fromJSON(object.item_attribute) : undefined, }; }, toJSON(message) { const obj = {}; if (message.transaction_date_time !== undefined) { obj.transaction_date_time = message.transaction_date_time; } if (message.transaction_amount_micros !== undefined) { obj.transaction_amount_micros = message.transaction_amount_micros; } if (message.currency_code !== undefined) { obj.currency_code = message.currency_code; } if (message.conversion_action !== undefined) { obj.conversion_action = message.conversion_action; } if (message.order_id !== undefined) { obj.order_id = message.order_id; } if (message.store_attribute !== undefined) { obj.store_attribute = StoreAttribute.toJSON(message.store_attribute); } if (message.custom_value !== undefined) { obj.custom_value = message.custom_value; } if (message.item_attribute !== undefined) { obj.item_attribute = ItemAttribute.toJSON(message.item_attribute); } return obj; }, create(base) { return TransactionAttribute.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e, _f; const message = createBaseTransactionAttribute(); message.transaction_date_time = (_a = object.transaction_date_time) !== null && _a !== void 0 ? _a : undefined; message.transaction_amount_micros = (_b = object.transaction_amount_micros) !== null && _b !== void 0 ? _b : undefined; message.currency_code = (_c = object.currency_code) !== null && _c !== void 0 ? _c : undefined; message.conversion_action = (_d = object.conversion_action) !== null && _d !== void 0 ? _d : undefined; message.order_id = (_e = object.order_id) !== null && _e !== void 0 ? _e : undefined; message.store_attribute = (object.store_attribute !== undefined && object.store_attribute !== null) ? StoreAttribute.fromPartial(object.store_attribute) : undefined; message.custom_value = (_f = object.custom_value) !== null && _f !== void 0 ? _f : undefined; message.item_attribute = (object.item_attribute !== undefined && object.item_attribute !== null) ? ItemAttribute.fromPartial(object.item_attribute) : undefined; return message; }, }; function createBaseStoreAttribute() { return { store_code: undefined }; } export const StoreAttribute = { encode(message, writer = _m0.Writer.create()) { if (message.store_code !== undefined) { writer.uint32(18).string(message.store_code); } 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 = createBaseStoreAttribute(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 2: if (tag !== 18) { break; } message.store_code = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { store_code: isSet(object.store_code) ? globalThis.String(object.store_code) : undefined }; }, toJSON(message) { const obj = {}; if (message.store_code !== undefined) { obj.store_code = message.store_code; } return obj; }, create(base) { return StoreAttribute.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a; const message = createBaseStoreAttribute(); message.store_code = (_a = object.store_code) !== null && _a !== void 0 ? _a : undefined; return message; }, }; function createBaseItemAttribute() { return { item_id: "", merchant_id: undefined, country_code: "", language_code: "", quantity: "0" }; } export const ItemAttribute = { encode(message, writer = _m0.Writer.create()) { if (message.item_id !== undefined && message.item_id !== "") { writer.uint32(10).string(message.item_id); } if (message.merchant_id !== undefined) { writer.uint32(16).int64(message.merchant_id); } if (message.country_code !== undefined && message.country_code !== "") { writer.uint32(26).string(message.country_code); } if (message.language_code !== undefined && message.language_code !== "") { writer.uint32(34).string(message.language_code); } if (message.quantity !== undefined && message.quantity !== "0") { writer.uint32(40).int64(message.quantity); } 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 = createBaseItemAttribute(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.item_id = reader.string(); continue; case 2: if (tag !== 16) { break; } message.merchant_id = longToString(reader.int64()); continue; case 3: if (tag !== 26) { break; } message.country_code = reader.string(); continue; case 4: if (tag !== 34) { break; } message.language_code = reader.string(); continue; case 5: if (tag !== 40) { break; } message.quantity = longToString(reader.int64()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { item_id: isSet(object.item_id) ? globalThis.String(object.item_id) : "", merchant_id: isSet(object.merchant_id) ? globalThis.String(object.merchant_id) : undefined, country_code: isSet(object.country_code) ? globalThis.String(object.country_code) : "", language_code: isSet(object.language_code) ? globalThis.String(object.language_code) : "", quantity: isSet(object.quantity) ? globalThis.String(object.quantity) : "0", }; }, toJSON(message) { const obj = {}; if (message.item_id !== undefined && message.item_id !== "") { obj.item_id = message.item_id; } if (message.merchant_id !== undefined) { obj.merchant_id = message.merchant_id; } if (message.country_code !== undefined && message.country_code !== "") { obj.country_code = message.country_code; } if (message.language_code !== undefined && message.language_code !== "") { obj.language_code = message.language_code; } if (message.quantity !== undefined && message.quantity !== "0") { obj.quantity = message.quantity; } return obj; }, create(base) { return ItemAttribute.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e; const message = createBaseItemAttribute(); message.item_id = (_a = object.item_id) !== null && _a !== void 0 ? _a : ""; message.merchant_id = (_b = object.merchant_id) !== null && _b !== void 0 ? _b : undefined; message.country_code = (_c = object.country_code) !== null && _c !== void 0 ? _c : ""; message.language_code = (_d = object.language_code) !== null && _d !== void 0 ? _d : ""; message.quantity = (_e = object.quantity) !== null && _e !== void 0 ? _e : "0"; return message; }, }; function createBaseUserData() { return { user_identifiers: [], transaction_attribute: undefined, user_attribute: undefined, consent: undefined }; } export const UserData = { encode(message, writer = _m0.Writer.create()) { if (message.user_identifiers !== undefined && message.user_identifiers.length !== 0) { for (const v of message.user_identifiers) { UserIdentifier.encode(v, writer.uint32(10).fork()).ldelim(); } } if (message.transaction_attribute !== undefined) { TransactionAttribute.encode(message.transaction_attribute, writer.uint32(18).fork()).ldelim(); } if (message.user_attribute !== undefined) { UserAttribute.encode(message.user_attribute, writer.uint32(26).fork()).ldelim(); } if (message.consent !== undefined) { Consent.encode(message.consent, writer.uint32(34).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 = createBaseUserData(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.user_identifiers.push(UserIdentifier.decode(reader, reader.uint32())); continue; case 2: if (tag !== 18) { break; } message.transaction_attribute = TransactionAttribute.decode(reader, reader.uint32()); continue; case 3: if (tag !== 26) { break; } message.user_attribute = UserAttribute.decode(reader, reader.uint32()); continue; case 4: if (tag !== 34) { break; } message.consent = Consent.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { user_identifiers: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.user_identifiers) ? object.user_identifiers.map((e) => UserIdentifier.fromJSON(e)) : [], transaction_attribute: isSet(object.transaction_attribute) ? TransactionAttribute.fromJSON(object.transaction_attribute) : undefined, user_attribute: isSet(object.user_attribute) ? UserAttribute.fromJSON(object.user_attribute) : undefined, consent: isSet(object.consent) ? Consent.fromJSON(object.consent) : undefined, }; }, toJSON(message) { var _a; const obj = {}; if ((_a = message.user_identifiers) === null || _a === void 0 ? void 0 : _a.length) { obj.user_identifiers = message.user_identifiers.map((e) => UserIdentifier.toJSON(e)); } if (message.transaction_attribute !== undefined) { obj.transaction_attribute = TransactionAttribute.toJSON(message.transaction_attribute); } if (message.user_attribute !== undefined) { obj.user_attribute = UserAttribute.toJSON(message.user_attribute); } if (message.consent !== undefined) { obj.consent = Consent.toJSON(message.consent); } return obj; }, create(base) { return UserData.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a; const message = createBaseUserData(); message.user_identifiers = ((_a = object.user_identifiers) === null || _a === void 0 ? void 0 : _a.map((e) => UserIdentifier.fromPartial(e))) || []; message.transaction_attribute = (object.transaction_attribute !== undefined && object.transaction_attribute !== null) ? TransactionAttribute.fromPartial(object.transaction_attribute) : undefined; message.user_attribute = (object.user_attribute !== undefined && object.user_attribute !== null) ? UserAttribute.fromPartial(object.user_attribute) : undefined; message.consent = (object.consent !== undefined && object.consent !== null) ? Consent.fromPartial(object.consent) : undefined; return message; }, }; function createBaseUserAttribute() { return { lifetime_value_micros: undefined, lifetime_value_bucket: undefined, last_purchase_date_time: "", average_purchase_count: 0, average_purchase_value_micros: "0", acquisition_date_time: "", shopping_loyalty: undefined, lifecycle_stage: "", first_purchase_date_time: "", event_attribute: [], }; } export const UserAttribute = { encode(message, writer = _m0.Writer.create()) { if (message.lifetime_value_micros !== undefined) { writer.uint32(8).int64(message.lifetime_value_micros); } if (message.lifetime_value_bucket !== undefined) { writer.uint32(16).int32(message.lifetime_value_bucket); } if (message.last_purchase_date_time !== undefined && message.last_purchase_date_time !== "") { writer.uint32(26).string(message.last_purchase_date_time); } if (message.average_purchase_count !== undefined && message.average_purchase_count !== 0) { writer.uint32(32).int32(message.average_purchase_count); } if (message.average_purchase_value_micros !== undefined && message.average_purchase_value_micros !== "0") { writer.uint32(40).int64(message.average_purchase_value_micros); } if (message.acquisition_date_time !== undefined && message.acquisition_date_time !== "") { writer.uint32(50).string(message.acquisition_date_time); } if (message.shopping_loyalty !== undefined) { ShoppingLoyalty.encode(message.shopping_loyalty, writer.uint32(58).fork()).ldelim(); } if (message.lifecycle_stage !== undefined && message.lifecycle_stage !== "") { writer.uint32(66).string(message.lifecycle_stage); } if (message.first_purchase_date_time !== undefined && message.first_purchase_date_time !== "") { writer.uint32(74).string(message.first_purchase_date_time); } if (message.event_attribute !== undefined && message.event_attribute.length !== 0) { for (const v of message.event_attribute) { EventAttribute.encode(v, writer.uint32(82).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 = createBaseUserAttribute(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 8) { break; } message.lifetime_value_micros = longToString(reader.int64()); continue; case 2: if (tag !== 16) { break; } message.lifetime_value_bucket = reader.int32(); continue; case 3: if (tag !== 26) { break; } message.last_purchase_date_time = reader.string(); continue; case 4: if (tag !== 32) { break; } message.average_purchase_count = reader.int32(); continue; case 5: if (tag !== 40) { break; } message.average_purchase_value_micros = longToString(reader.int64()); continue; case 6: if (tag !== 50) { break; } message.acquisition_date_time = reader.string(); continue; case 7: if (tag !== 58) { break; } message.shopping_loyalty = ShoppingLoyalty.decode(reader, reader.uint32()); continue; case 8: if (tag !== 66) { break; } message.lifecycle_stage = reader.string(); continue; case 9: if (tag !== 74) { break; } message.first_purchase_date_time = reader.string(); continue; case 10: if (tag !== 82) { break; } message.event_attribute.push(EventAttribute.decode(reader, reader.uint32())); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { lifetime_value_micros: isSet(object.lifetime_value_micros) ? globalThis.String(object.lifetime_value_micros) : undefined, lifetime_value_bucket: isSet(object.lifetime_value_bucket) ? globalThis.Number(object.lifetime_value_bucket) : undefined, last_purchase_date_time: isSet(object.last_purchase_date_time) ? globalThis.String(object.last_purchase_date_time) : "", average_purchase_count: isSet(object.average_purchase_count) ? globalThis.Number(object.average_purchase_count) : 0, average_purchase_value_micros: isSet(object.average_purchase_value_micros) ? globalThis.String(object.average_purchase_value_micros) : "0", acquisition_date_time: isSet(object.acquisition_date_time) ? globalThis.String(object.acquisition_date_time) : "", shopping_loyalty: isSet(object.shopping_loyalty) ? ShoppingLoyalty.fromJSON(object.shopping_loyalty) : undefined, lifecycle_stage: isSet(object.lifecycle_stage) ? globalThis.String(object.lifecycle_stage) : "", first_purchase_date_time: isSet(object.first_purchase_date_time) ? globalThis.String(object.first_purchase_date_time) : "", event_attribute: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.event_attribute) ? object.event_attribute.map((e) => EventAttribute.fromJSON(e)) : [], }; }, toJSON(message) { var _a; const obj = {}; if (message.lifetime_value_micros !== undefined) { obj.lifetime_value_micros = message.lifetime_value_micros; } if (message.lifetime_value_bucket !== undefined) { obj.lifetime_value_bucket = Math.round(message.lifetime_value_bucket); } if (message.last_purchase_date_time !== undefined && message.last_purchase_date_time !== "") { obj.last_purchase_date_time = message.last_purchase_date_time; } if (message.average_purchase_count !== undefined && message.average_purchase_count !== 0) { obj.average_purchase_count = Math.round(message.average_purchase_count); } if (message.average_purchase_value_micros !== undefined && message.average_purchase_value_micros !== "0") { obj.average_purchase_value_micros = message.average_purchase_value_micros; } if (message.acquisition_date_time !== undefined && message.acquisition_date_time !== "") { obj.acquisition_date_time = message.acquisition_date_time; } if (message.shopping_loyalty !== undefined) { obj.shopping_loyalty = ShoppingLoyalty.toJSON(message.shopping_loyalty); } if (message.lifecycle_stage !== undefined && message.lifecycle_stage !== "") { obj.lifecycle_stage = message.lifecycle_stage; } if (message.first_purchase_date_time !== undefined && message.first_purchase_date_time !== "") { obj.first_purchase_date_time = message.first_purchase_date_time; } if ((_a = message.event_attribute) === null || _a === void 0 ? void 0 : _a.length) { obj.event_attribute = message.event_attribute.map((e) => EventAttribute.toJSON(e)); } return obj; }, create(base) { return UserAttribute.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c, _d, _e, _f, _g, _h, _j; const message = createBaseUserAttribute(); message.lifetime_value_micros = (_a = object.lifetime_value_micros) !== null && _a !== void 0 ? _a : undefined; message.lifetime_value_bucket = (_b = object.lifetime_value_bucket) !== null && _b !== void 0 ? _b : undefined; message.last_purchase_date_time = (_c = object.last_purchase_date_time) !== null && _c !== void 0 ? _c : ""; message.average_purchase_count = (_d = object.average_purchase_count) !== null && _d !== void 0 ? _d : 0; message.average_purchase_value_micros = (_e = object.average_purchase_value_micros) !== null && _e !== void 0 ? _e : "0"; message.acquisition_date_time = (_f = object.acquisition_date_time) !== null && _f !== void 0 ? _f : ""; message.shopping_loyalty = (object.shopping_loyalty !== undefined && object.shopping_loyalty !== null) ? ShoppingLoyalty.fromPartial(object.shopping_loyalty) : undefined; message.lifecycle_stage = (_g = object.lifecycle_stage) !== null && _g !== void 0 ? _g : ""; message.first_purchase_date_time = (_h = object.first_purchase_date_time) !== null && _h !== void 0 ? _h : ""; message.event_attribute = ((_j = object.event_attribute) === null || _j === void 0 ? void 0 : _j.map((e) => EventAttribute.fromPartial(e))) || []; return message; }, }; function createBaseEventAttribute() { return { event: "", event_date_time: "", item_attribute: [] }; } export const EventAttribute = { encode(message, writer = _m0.Writer.create()) { if (message.event !== undefined && message.event !== "") { writer.uint32(10).string(message.event); } if (message.event_date_time !== undefined && message.event_date_time !== "") { writer.uint32(18).string(message.event_date_time); } if (message.item_attribute !== undefined && message.item_attribute.length !== 0) { for (const v of message.item_attribute) { EventItemAttribute.encode(v, 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 = createBaseEventAttribute(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.event = reader.string(); continue; case 2: if (tag !== 18) { break; } message.event_date_time = reader.string(); continue; case 3: if (tag !== 26) { break; } message.item_attribute.push(EventItemAttribute.decode(reader, reader.uint32())); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { event: isSet(object.event) ? globalThis.String(object.event) : "", event_date_time: isSet(object.event_date_time) ? globalThis.String(object.event_date_time) : "", item_attribute: globalThis.Array.isArray(object === null || object === void 0 ? void 0 : object.item_attribute) ? object.item_attribute.map((e) => EventItemAttribute.fromJSON(e)) : [], }; }, toJSON(message) { var _a; const obj = {}; if (message.event !== undefined && message.event !== "") { obj.event = message.event; } if (message.event_date_time !== undefined && message.event_date_time !== "") { obj.event_date_time = message.event_date_time; } if ((_a = message.item_attribute) === null || _a === void 0 ? void 0 : _a.length) { obj.item_attribute = message.item_attribute.map((e) => EventItemAttribute.toJSON(e)); } return obj; }, create(base) { return EventAttribute.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a, _b, _c; const message = createBaseEventAttribute(); message.event = (_a = object.event) !== null && _a !== void 0 ? _a : ""; message.event_date_time = (_b = object.event_date_time) !== null && _b !== void 0 ? _b : ""; message.item_attribute = ((_c = object.item_attribute) === null || _c === void 0 ? void 0 : _c.map((e) => EventItemAttribute.fromPartial(e))) || []; return message; }, }; function createBaseEventItemAttribute() { return { item_id: "" }; } export const EventItemAttribute = { encode(message, writer = _m0.Writer.create()) { if (message.item_id !== undefined && message.item_id !== "") { writer.uint32(10).string(message.item_id); } 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 = createBaseEventItemAttribute(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.item_id = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { item_id: isSet(object.item_id) ? globalThis.String(object.item_id) : "" }; }, toJSON(message) { const obj = {}; if (message.item_id !== undefined && message.item_id !== "") { obj.item_id = message.item_id; } return obj; }, create(base) { return EventItemAttribute.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a; const message = createBaseEventItemAttribute(); message.item_id = (_a = object.item_id) !== null && _a !== void 0 ? _a : ""; return message; }, }; function createBaseShoppingLoyalty() { return { loyalty_tier: undefined }; } export const ShoppingLoyalty = { encode(message, writer = _m0.Writer.create()) { if (message.loyalty_tier !== undefined) { writer.uint32(10).string(message.loyalty_tier); } 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 = createBaseShoppingLoyalty(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.loyalty_tier = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { loyalty_tier: isSet(object.loyalty_tier) ? globalThis.String(object.loyalty_tier) : undefined }; }, toJSON(message) { const obj = {}; if (message.loyalty_tier !== undefined) { obj.loyalty_tier = message.loyalty_tier; } return obj; }, create(base) { return ShoppingLoyalty.fromPartial(base !== null && base !== void 0 ? base : {}); }, fromPartial(object) { var _a; const message = createBaseShoppingLoyalty(); message.loyalty_tier = (_a = object.loyalty_tier) !== null && _a !== void 0 ? _a : undefined; return message; }, }; function createBaseCustomerMatchUserListMetadata() { return { user_list: undefined, consent: undefined }; } export const CustomerMatchUserListMetadata = { encode(message, writer = _m0.Writer.create()) { if (message.user_list !== undefined) { writer.uint32(18).string(message.user_list); } if (message.consent !== undefined) { Consent.encode(message.consent, 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 = createBaseCustomerMatchUserListMetadata(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 2: if (tag !== 18) { break; } message.user_list = reader.string(); continue; case 3: if (tag !== 26) { break; } message.consent = Consent.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { user_list: isSet(object.user_list) ? globalThis.String(object.user_list) : undefined, consent: isSet(object.consent) ? Consent.fromJSON(object.consent) : undefined, }; }, toJSON(message) { const obj = {}; if (message.user_list !== undefined) { obj.user_list = message.user_list; } if (message.consent !== undefined) { obj.consent = Consent.toJSON(message.consent); } return obj; }, create(base) { return CustomerMatchUserListMetadata.fromPartial(base !== null && base !== void 0 ? base :