// Code generated by sidekick. DO NOT EDIT.
//
// 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
//
//     https://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.

import Foundation
import GoogleCloudWkt

/// Request message for
/// [ProductService.AddLocalInventories][google.cloud.retail.v2.ProductService.AddLocalInventories]
/// method.
///
/// [google.cloud.retail.v2.ProductService.AddLocalInventories]: <doc:ProductService/addLocalInventories(request:)>
public struct AddLocalInventoriesRequest: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Required. Full resource name of [Product][google.cloud.retail.v2.Product],
  /// such as
  /// `projects/*/locations/global/catalogs/default_catalog/branches/default_branch/products/some_product_id`.
  ///
  /// If the caller does not have permission to access the
  /// [Product][google.cloud.retail.v2.Product], regardless of whether or not it
  /// exists, a PERMISSION_DENIED error is returned.
  ///
  /// [google.cloud.retail.v2.Product]: <doc:Product>
  public var product: Swift.String = Swift.String()

  /// Required. A list of inventory information at difference places. Each place
  /// is identified by its place ID. At most 3000 inventories are allowed per
  /// request.
  public var localInventories: [LocalInventory] = []

  /// Indicates which inventory fields in the provided list of
  /// [LocalInventory][google.cloud.retail.v2.LocalInventory] to update. The
  /// field is updated to the provided value.
  ///
  /// If a field is set while the place does not have a previous local inventory,
  /// the local inventory at that store is created.
  ///
  /// If a field is set while the value of that field is not provided, the
  /// original field value, if it exists, is deleted.
  ///
  /// If the mask is not set or set with empty paths, all inventory fields will
  /// be updated.
  ///
  /// If an unsupported or unknown field is provided, an INVALID_ARGUMENT error
  /// is returned and the entire update will be ignored.
  ///
  /// [google.cloud.retail.v2.LocalInventory]: <doc:LocalInventory>
  public var addMask: GoogleCloudWkt.FieldMask? = nil

  /// The time when the inventory updates are issued. Used to prevent
  /// out-of-order updates on local inventory fields. If not provided, the
  /// internal system time will be used.
  public var addTime: GoogleCloudWkt.Timestamp? = nil

  /// If set to true, and the [Product][google.cloud.retail.v2.Product] is not
  /// found, the local inventory will still be processed and retained for at most
  /// 1 day and processed once the [Product][google.cloud.retail.v2.Product] is
  /// created. If set to false, a NOT_FOUND error is returned if the
  /// [Product][google.cloud.retail.v2.Product] is not found.
  ///
  /// [google.cloud.retail.v2.Product]: <doc:Product>
  public var allowMissing: Swift.Bool = Swift.Bool()

  /// Initialize a new instance of `AddLocalInventoriesRequest`.
  public init() {}

  /// Use `config` to return a new instance of this object, with some fields updated.
  ///
  /// Commonly used to initialize the value, for example:
  ///
  /// ```
  /// let value = AddLocalInventoriesRequest().with { $0.product = ... }
  /// ```
  public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
    var copy = self
    try config(&copy)
    return copy
  }

  public static var _anyTypeUrl: Swift.String {
    return "type.googleapis.com/google.cloud.retail.v2.AddLocalInventoriesRequest"
  }
  public init(fromAny any: GoogleCloudWkt.`Any`) throws {
    self = try GoogleCloudWkt._slowAnyDeserialize(Self.self, from: any)
  }
  public func _pack() throws -> GoogleCloudWkt.Struct {
    return try GoogleCloudWkt._slowAnySerialize(message: self)
  }
}
