//flynt-disable lower_snake_case
//flynt-disable unsigned-integers-not-allowed
//flynt-disable rest-path-kebab-case
syntax = "proto3";

package com.wix.ecommerce.inventory.api.v1;

import "google/protobuf/wrappers.proto";
import "google/protobuf/field_mask.proto";
import "google/protobuf/timestamp.proto";
import "wix/inventory/api/v1/inventoryItem.proto";
import "wix/api/annotations.proto";
import "wix/api/entity.proto";
import "wix/inventory/api/v1/preOrderInfo.proto";


message InventoryItemChanged {
    // Inventory item ID.
    string inventory_item_id = 1;
    // Deprecated: use productId.
    string external_id = 2 [deprecated = true, (.wix.api.field_deprecated) = {
        replaced_by: "product_id"
        target_removal_date: "2024-12-31"
    }];
    // Product ID.
    string product_id = 4;
    // Whether inventory is being tracked.
    bool track_inventory = 3;
    // Preorder information.
    .wix.inventory.api.v1.PreorderInfo preorder_info = 6;
    // Field mask of updated fields.
    google.protobuf.FieldMask fieldMask = 7;
    // Date and time the inventory item was last updated.
    google.protobuf.Timestamp updated_date = 8;
}

message InventoryVariantsChanged {
    option (.wix.api.entity) = {
        fqdn: "wix.ecommerce.inventory.v1.variant_changed"
        segment: USERS
    };
    // Inventory item ID.
    string inventory_item_id = 1;
    // Deprecated: use productId.
    string external_id = 2 [deprecated = true, (.wix.api.field_deprecated) = {
        replaced_by: "product_id"
        target_removal_date: "2024-12-31"
    }];
    // Product ID.
    string product_id = 4;
    // Information about changed variants.
    repeated ChangedInventoryVariant variants = 3;
    // Reason data
    .wix.inventory.api.v1.ReasonTypeWrapper.ReasonType reason = 6 [(.wix.api.field_exposure) = INTERNAL];
    // Date and time the inventory variant item was last updated.
    google.protobuf.Timestamp updated_date = 8;
}

message ChangedInventoryVariant {
    // Variant ID.
    string id = 1;
    //Previous inventory variant data.
    ChangedInventoryVariantData old_value = 2;
    //Current inventory variant data.
    ChangedInventoryVariantData new_value = 3;
}

message ChangedInventoryVariantData {
    // Inventory variant quantity.
    google.protobuf.Int32Value quantity = 1;
    // Whether the product variant is in stock.
    bool inStock = 2;
    // Whether the variant is available for preorder. When `true`, the variant is out of stock and preorder is enabled on inventory level.
    bool available_for_preorder = 3;
}
