syntax = "proto3"; package cart_messages; option go_package = "git.k6n.net/mats/go-cart-actor/proto/cart;cart_messages"; import "google/protobuf/any.proto"; import "google/protobuf/timestamp.proto"; message ClearCartRequest {} message AddItem { uint32 item_id = 1; int32 quantity = 2; int64 price = 3; int64 orgPrice = 9; string sku = 4; string name = 5; string image = 6; int32 stock = 7; int32 tax = 8; string brand = 13; string category = 14; string category2 = 15; string category3 = 16; string category4 = 17; string category5 = 18; string disclaimer = 10; string articleType = 11; string sellerId = 19; string sellerName = 20; string country = 21; string saleStatus = 24; optional string outlet = 12; optional string storeId = 22; optional uint32 parentId = 23; string cgm = 25; optional google.protobuf.Timestamp reservationEndTime = 26; // extra_json carries arbitrary product data (the flat product document minus // the fields mapped above) as raw JSON. It is stored losslessly and surfaced // as flattened keys on the cart item. bytes extra_json = 27; // custom_fields holds optional user-supplied input fields for this line // (e.g. engraving text, configurator notes), keyed by field name. map custom_fields = 28; bool inventory_tracked = 29; bool drop_ship = 30; } message RemoveItem { uint32 Id = 1; } message ChangeQuantity { uint32 Id = 1; int32 quantity = 2; } message SetUserId { string userId = 1; } message LineItemMarking { uint32 id = 1; uint32 type = 2; string marking = 3; } message RemoveLineItemMarking { uint32 id = 1; } // SetLineItemCustomFields sets/merges user-supplied custom input fields on an // existing cart line (the dict equivalent of a line item marking). message SetLineItemCustomFields { uint32 id = 1; map custom_fields = 2; } message SubscriptionAdded { uint32 itemId = 1; string detailsId = 3; string orderReference = 4; } message AddVoucher { string code = 1; int64 value = 2; repeated string voucherRules = 3; string description = 4; } message RemoveVoucher { uint32 id = 1; } message UpsertSubscriptionDetails { optional string id = 1; string offeringCode = 2; string signingType = 3; google.protobuf.Any data = 4; } enum CartType { REGULAR = 0; WISHLIST = 1; OFFER = 2; } message SetCartType { CartType type = 1; } // PushToken is a generic, provider-agnostic push-delivery target. The cart layer // only stores what it was given — actual delivery (FCM, APNs, Web Push) is the // notifier's job (see pkg/cart/recovery.LoggingNotifier for the v0 contract). // // Platform is free-form (e.g. "fcm", "apns", "webpush") so callers can record // multiple devices per cart without forcing a schema decision here. message PushToken { string platform = 1; string token = 2; } // SetRecoveryContact attaches the contact bundle used by the abandoned-cart // recovery flow. PUT-style: replaces the entire contact in one event — empty // strings or empty token lists are persisted as "no contact". message SetRecoveryContact { string email = 1; repeated PushToken push_tokens = 2; } message Mutation { oneof type { ClearCartRequest clear_cart = 1; AddItem add_item = 2; RemoveItem remove_item = 3; ChangeQuantity change_quantity = 4; SetUserId set_user_id = 5; LineItemMarking line_item_marking = 6; RemoveLineItemMarking remove_line_item_marking = 7; SubscriptionAdded subscription_added = 8; SetLineItemCustomFields set_line_item_custom_fields = 9; AddVoucher add_voucher = 20; RemoveVoucher remove_voucher = 21; UpsertSubscriptionDetails upsert_subscription_details = 22; SetCartType set_cart_type = 23; SetRecoveryContact set_recovery_contact = 24; } }