// 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

/// A route defines a path from VM instances within a spoke to a specific
/// destination resource. Only VPC spokes have routes.
public struct Route: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Immutable. The name of the route. Route names must be unique. Route names
  /// use the following form:
  ///      `projects/{project_number}/locations/global/hubs/{hub}/routeTables/{route_table_id}/routes/{route_id}`
  public var name: Swift.String = Swift.String()

  /// Output only. The time the route was created.
  public var createTime: GoogleCloudWkt.Timestamp? = nil

  /// Output only. The time the route was last updated.
  public var updateTime: GoogleCloudWkt.Timestamp? = nil

  /// The destination IP address range.
  public var ipCidrRange: Swift.String = Swift.String()

  /// Output only. The route's type. Its type is determined by the properties of
  /// its IP address range.
  public var type: RouteType = RouteType()

  /// Immutable. The destination VPC network for packets on this route.
  public var nextHopVpcNetwork: NextHopVpcNetwork? = nil

  /// Optional labels in key-value pair format. For more information about
  /// labels, see [Requirements for
  /// labels](https://cloud.google.com/resource-manager/docs/creating-managing-labels#requirements).
  public var labels: [Swift.String: Swift.String] = [:]

  /// An optional description of the route.
  public var description: Swift.String = Swift.String()

  /// Output only. The Google-generated UUID for the route. This value is unique
  /// across all Network Connectivity Center route resources. If a
  /// route is deleted and another with the same name is created,
  /// the new route is assigned a different `uid`.
  public var uid: Swift.String = Swift.String()

  /// Output only. The current lifecycle state of the route.
  public var state: State = State()

  /// Immutable. The spoke that this route leads to.
  /// Example: projects/12345/locations/global/spokes/SPOKE
  public var spoke: Swift.String = Swift.String()

  /// Output only. The origin location of the route.
  /// Uses the following form: "projects/{project}/locations/{location}"
  /// Example: projects/1234/locations/us-central1
  public var location: Swift.String = Swift.String()

  /// Output only. The priority of this route. Priority is used to break ties in
  /// cases where a destination matches more than one route. In these cases the
  /// route with the lowest-numbered priority value wins.
  public var priority: Swift.Int64 = Swift.Int64()

  /// Immutable. The next-hop VPN tunnel for packets on this route.
  public var nextHopVpnTunnel: NextHopVPNTunnel? = nil

  /// Immutable. The next-hop Router appliance instance for packets on this
  /// route.
  public var nextHopRouterApplianceInstance: NextHopRouterApplianceInstance? = nil

  /// Immutable. The next-hop VLAN attachment for packets on this route.
  public var nextHopInterconnectAttachment: NextHopInterconnectAttachment? = nil

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