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

#if OrganizationSecurityPolicies || RegionSecurityPolicies || SecurityPolicies
  import Foundation
  import GoogleCloudWkt

  /// Represents a match condition that incoming network traffic is evaluated
  /// against.
  public struct SecurityPolicyRuleNetworkMatcher: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Destination IPv4/IPv6 addresses or CIDR prefixes, in standard text
    /// format.
    public var destIpRanges: [Swift.String] = []

    /// Destination port numbers for TCP/UDP/SCTP. Each element can be a 16-bit
    /// unsigned decimal number (e.g. "80") or range (e.g. "0-1023").
    public var destPorts: [Swift.String] = []

    /// IPv4 protocol / IPv6 next header (after extension headers). Each
    /// element can be an 8-bit unsigned decimal number (e.g. "6"), range (e.g.
    /// "253-254"), or one of the following protocol names: "tcp", "udp",
    /// "icmp", "esp", "ah", "ipip", or "sctp".
    public var ipProtocols: [Swift.String] = []

    /// BGP Autonomous System Number associated with the source IP address.
    public var srcAsns: [Swift.UInt32] = []

    /// Source IPv4/IPv6 addresses or CIDR prefixes, in standard text format.
    public var srcIpRanges: [Swift.String] = []

    /// Source port numbers for TCP/UDP/SCTP. Each element can be a 16-bit
    /// unsigned decimal number (e.g. "80") or range (e.g. "0-1023").
    public var srcPorts: [Swift.String] = []

    /// Two-letter ISO 3166-1 alpha-2 country code associated with the source
    /// IP address.
    public var srcRegionCodes: [Swift.String] = []

    /// User-defined fields. Each element names a defined field and lists the
    /// matching values for that field.
    public var userDefinedFields: [SecurityPolicyRuleNetworkMatcherUserDefinedFieldMatch] = []

    /// Initialize a new instance of `SecurityPolicyRuleNetworkMatcher`.
    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 = SecurityPolicyRuleNetworkMatcher().with { $0.destIpRanges = ... }
    /// ```
    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.compute.v1.SecurityPolicyRuleNetworkMatcher"
    }
    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)
    }
  }
#endif
