// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

syntax = "proto3";

package google.shopping.merchant.inventories.v1;

import "google/api/field_behavior.proto";
import "google/shopping/type/types.proto";
import "google/type/interval.proto";

option csharp_namespace = "Google.Shopping.Merchant.Inventories.V1";
option go_package = "cloud.google.com/go/shopping/merchant/inventories/apiv1/inventoriespb;inventoriespb";
option java_multiple_files = true;
option java_outer_classname = "InventoriesCommonProto";
option java_package = "com.google.shopping.merchant.inventories.v1";
option php_namespace = "Google\\Shopping\\Merchant\\Inventories\\V1";
option ruby_package = "Google::Shopping::Merchant::Inventories::V1";

// Local inventory attributes.
message LocalInventoryAttributes {
  // [Availability](https://support.google.com/merchants/answer/3061342) of the
  // product at this store.
  enum Availability {
    // Indicates that the availability is unspecified.
    LOCAL_INVENTORY_AVAILABILITY_UNSPECIFIED = 0;

    // Indicates that the product is in stock.
    IN_STOCK = 1;

    // Indicates that the product is out of stock.
    LIMITED_AVAILABILITY = 2;

    // Indicates that the product is on display to order.
    ON_DISPLAY_TO_ORDER = 3;

    // Indicates that the product is out of stock.
    OUT_OF_STOCK = 4;
  }

  // Supported [pickup
  // method](https://support.google.com/merchants/answer/3061342) for this
  // product. Unless the value is `"not supported"`, this field must be
  // submitted together with `pickupSla`.
  enum PickupMethod {
    // Indicates that the pickup method is unspecified.
    PICKUP_METHOD_UNSPECIFIED = 0;

    // Indicates that the pickup method is Buy.
    BUY = 1;

    // Indicates that the pickup method is Reserve.
    RESERVE = 2;

    // Indicates that the pickup method is Ship to store.
    SHIP_TO_STORE = 3;

    // Indicates that the pickup method is not supported.
    NOT_SUPPORTED = 4;
  }

  // Relative time period from the order date for an order for this product,
  // from this store, to be ready for pickup. Must be submitted with
  // `pickupMethod`. See more details
  // [here](https://support.google.com/merchants/answer/3061342).
  enum PickupSla {
    // Indicates that the pickup SLA is unspecified.
    PICKUP_SLA_UNSPECIFIED = 0;

    // Indicates that the pickup SLA is same day.
    SAME_DAY = 1;

    // Indicates that the pickup SLA is next day.
    NEXT_DAY = 2;

    // Indicates that the pickup SLA is two days.
    TWO_DAY = 3;

    // Indicates that the pickup SLA is three days.
    THREE_DAY = 4;

    // Indicates that the pickup SLA is four days.
    FOUR_DAY = 5;

    // Indicates that the pickup SLA is five days.
    FIVE_DAY = 6;

    // Indicates that the pickup SLA is six days.
    SIX_DAY = 7;

    // Indicates that the pickup SLA is seven days.
    SEVEN_DAY = 8;

    // Indicates that the pickup SLA is multi-week.
    MULTI_WEEK = 9;
  }

  // Optional. Price of the product at this store.
  google.shopping.type.Price price = 1 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Sale price of the product at this store. Mandatory if
  // [`salePriceEffectiveDate`][LocalInventory.sale_price_effective_date] is
  // defined.
  google.shopping.type.Price sale_price = 2
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The `TimePeriod` of the
  // sale at this store.
  google.type.Interval sale_price_effective_date = 3
      [(google.api.field_behavior) = OPTIONAL];

  // [Availability](https://support.google.com/merchants/answer/3061342) of the
  // product at this store.
  optional Availability availability = 4;

  // Optional. Quantity of the product available at this store. Must be greater
  // than or equal to zero.
  optional int64 quantity = 5 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Supported [pickup
  // method](https://support.google.com/merchants/answer/3061342) for this
  // product. Unless the value is `"not supported"`, this field must be
  // submitted together with `pickupSla`.
  optional PickupMethod pickup_method = 6
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Relative time period from the order date for an order for this
  // product, from this store, to be ready for pickup. Must be submitted with
  // `pickupMethod`. See more details
  // [here](https://support.google.com/merchants/answer/3061342).
  optional PickupSla pickup_sla = 7 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Location of the product inside the store. Maximum length is 20
  // bytes.
  optional string instore_product_location = 8
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. Specifies a label associated with the shipping for the
  // `LocalInventory` resource. Can be used to group local shipping services to
  // this particular inventory item. For accepted field format, see the [Local
  // delivery](https://support.google.com/merchants/answer/14819809#localdelivery)
  optional string local_shipping_label = 9
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. An optional list of loyalty programs containing applicable
  // loyalty member prices for this product at this store.
  //
  // This field is used to show store-specific member prices on Local
  // Inventory Ads (LIA).
  //
  // To use this, the loyalty program must be configured in Google Merchant
  // Center. The benefits provided must match the merchant's website and be
  // clear to members. This is only applicable for merchants in supported
  // countries.
  //
  // See [Loyalty program](https://support.google.com/merchants/answer/12922446)
  // for details on supported countries and loyalty program configuration.
  // For local inventory specific details, see the [Local inventory data
  // specification](https://support.google.com/merchants/answer/3061342).
  repeated InventoryLoyaltyProgram loyalty_programs = 10
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. A list of custom (merchant-provided) attributes. It can also be
  // used for submitting any attribute of the data specification in its generic
  // form (for example, `{ "name": "size type", "value": "regular" }`). This is
  // useful for submitting attributes not explicitly exposed by the API. Maximum
  // allowed number of characters for each custom attribute is 10240 (represents
  // sum of characters for name and value). Maximum 2500 custom attributes can
  // be set, with total size of 102.4kB. Underscores in custom
  // attribute names are replaced by spaces upon insertion.
  repeated google.shopping.type.CustomAttribute custom_attributes = 11
      [(google.api.field_behavior) = OPTIONAL];
}

// A message that represents loyalty program.
message InventoryLoyaltyProgram {
  // The label of the loyalty program. This is an internal label that uniquely
  // identifies the relationship between a business entity and a loyalty
  // program entity. The label must be provided if there are multiple loyalty
  // programs available for the merchant, so that the system can associate
  // the assets below (for example, price and points) with the correct business.
  // The corresponding program must be linked to the Merchant Center account.
  optional string program_label = 1;

  // The label of the tier within the loyalty program.
  // Must match one of the labels within the program.
  optional string tier_label = 2;

  // The price for members of the given tier, that is, the instant discount
  // price. Must be smaller or equal to the regular price.
  optional google.shopping.type.Price price = 3;

  // The cashback that can be used for future purchases.
  optional google.shopping.type.Price cashback_for_future_use = 4;

  // The amount of loyalty points earned on a purchase.
  optional int64 loyalty_points = 5;

  // A date range during which the item is eligible for member price. If not
  // specified, the member price is always applicable. The date range is
  // represented by a pair of ISO 8601 dates separated by a space,
  // comma, or slash.
  optional google.type.Interval member_price_effective_interval = 6;

  // The label of the shipping benefit. If the field has value, this offer has
  // loyalty shipping benefit. If the field value isn't provided, the item is
  // not eligible for loyalty shipping for the given loyalty tier.
  optional string shipping_label = 7;
}

// Regional inventory attributes.
message RegionalInventoryAttributes {
  // [Availability](https://support.google.com/merchants/answer/14644124) of the
  // product in this region.
  enum Availability {
    // Indicates that the availability is unspecified.
    REGIONAL_INVENTORY_AVAILABILITY_UNSPECIFIED = 0;

    // Indicates that the product is in stock.
    IN_STOCK = 1;

    // Indicates that the product is out of stock.
    OUT_OF_STOCK = 2;
  }

  // Optional. Price of the product in this region.
  google.shopping.type.Price price = 1 [(google.api.field_behavior) = OPTIONAL];

  // Optional. Sale price of the product in this region. Mandatory if
  // [`salePriceEffectiveDate`][RegionalInventory.sale_price_effective_date] is
  // defined.
  google.shopping.type.Price sale_price = 2
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. The `TimePeriod` of the
  // sale price in this region.
  google.type.Interval sale_price_effective_date = 3
      [(google.api.field_behavior) = OPTIONAL];

  // Optional.
  // [Availability](https://support.google.com/merchants/answer/14644124) of the
  // product in this region.
  optional Availability availability = 4
      [(google.api.field_behavior) = OPTIONAL];

  // Optional. An optional list of loyalty programs containing applicable
  // loyalty member prices for this product in this region.
  //
  // This field is used to show region-specific member prices on Product
  // Listing Ads (PLA).
  //
  // To use this, the loyalty program must be configured in Google Merchant
  // Center, and the merchant must be using the Regional Availability and
  // Pricing (RAAP) feature. The benefits provided must match the merchant's
  // website and be clear to members. This is only applicable for merchants in
  // supported countries.
  //
  // See [Loyalty program](https://support.google.com/merchants/answer/12922446)
  // for details on supported countries and loyalty program configuration.
  // Also see [Regional availability and
  // pricing](https://support.google.com/merchants/answer/14644124) and [How to
  // set up regional member
  // pricing](https://support.google.com/merchants/answer/16388178) for more
  // information.
  repeated InventoryLoyaltyProgram loyalty_programs = 5
      [(google.api.field_behavior) = OPTIONAL];
}
