// 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 to set a specified branch as new default_branch.
public struct SetDefaultBranchRequest: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Full resource name of the catalog, such as
  /// `projects/*/locations/global/catalogs/default_catalog`.
  public var catalog: Swift.String = Swift.String()

  /// The final component of the resource name of a branch.
  ///
  /// This field must be one of "0", "1" or "2". Otherwise, an INVALID_ARGUMENT
  /// error is returned.
  ///
  /// If there are no sufficient active products in the targeted branch and
  /// [force][google.cloud.retail.v2.SetDefaultBranchRequest.force] is not set, a
  /// FAILED_PRECONDITION error is returned.
  ///
  /// [google.cloud.retail.v2.SetDefaultBranchRequest.force]: <doc:SetDefaultBranchRequest/force>
  public var branchId: Swift.String = Swift.String()

  /// Some note on this request, this can be retrieved by
  /// [CatalogService.GetDefaultBranch][google.cloud.retail.v2.CatalogService.GetDefaultBranch]
  /// before next valid default branch set occurs.
  ///
  /// This field must be a UTF-8 encoded string with a length limit of 1,000
  /// characters. Otherwise, an INVALID_ARGUMENT error is returned.
  ///
  /// [google.cloud.retail.v2.CatalogService.GetDefaultBranch]: <doc:CatalogService/getDefaultBranch(request:)>
  public var note: Swift.String = Swift.String()

  /// If set to true, it permits switching to a branch with
  /// [branch_id][google.cloud.retail.v2.SetDefaultBranchRequest.branch_id] even
  /// if it has no sufficient active products.
  ///
  /// [google.cloud.retail.v2.SetDefaultBranchRequest.branch_id]: <doc:SetDefaultBranchRequest/branchId>
  public var force: Swift.Bool = Swift.Bool()

  /// Initialize a new instance of `SetDefaultBranchRequest`.
  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 = SetDefaultBranchRequest().with { $0.catalog = ... }
  /// ```
  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.SetDefaultBranchRequest"
  }
  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)
  }
}
