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

/// Malicious URI Filter Result.
public struct MaliciousUriFilterResult: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// Output only. Reports whether Malicious URI filter was successfully executed
  /// or not.
  public var executionState: FilterExecutionState = FilterExecutionState()

  /// Optional messages corresponding to the result.
  /// A message can provide warnings or error details.
  /// For example, if execution state is skipped then this field provides
  /// related reason/explanation.
  public var messageItems: [MessageItem] = []

  /// Output only. Match state for this Malicious URI.
  /// Value is MATCH_FOUND if at least one Malicious URI is found.
  public var matchState: FilterMatchState = FilterMatchState()

  /// List of Malicious URIs found in data.
  public var maliciousUriMatchedItems: [MaliciousUriFilterResult.MaliciousUriMatchedItem] = []

  /// Initialize a new instance of `MaliciousUriFilterResult`.
  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 = MaliciousUriFilterResult().with { $0.executionState = ... }
  /// ```
  public func with(_ config: (inout Self) throws -> Swift.Void) rethrows -> Self {
    var copy = self
    try config(&copy)
    return copy
  }

  /// Information regarding malicious URI and its location within the input
  /// content.
  public struct MaliciousUriMatchedItem: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Malicious URI.
    public var uri: Swift.String = Swift.String()

    /// List of locations where Malicious URI is identified.
    /// The `locations` field is supported only for plaintext content i.e.
    /// ByteItemType.PLAINTEXT_UTF8
    public var locations: [RangeInfo] = []

    /// Initialize a new instance of `MaliciousUriMatchedItem`.
    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 = MaliciousUriMatchedItem().with { $0.uri = ... }
    /// ```
    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.modelarmor.v1.MaliciousUriFilterResult.MaliciousUriMatchedItem"
    }
    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)
    }
  }

  public static var _anyTypeUrl: Swift.String {
    return "type.googleapis.com/google.cloud.modelarmor.v1.MaliciousUriFilterResult"
  }
  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)
  }
}
