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

/// Response for SearchJob method.
public struct SearchJobsResponse: Codable, Equatable, GoogleCloudWkt._AnyPackable,
  Sendable
{
  /// The Job entities that match the specified
  /// [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest].
  ///
  /// [google.cloud.talent.v4.SearchJobsRequest]: <doc:SearchJobsRequest>
  public var matchingJobs: [SearchJobsResponse.MatchingJob] = []

  /// The histogram results that match with specified
  /// [SearchJobsRequest.histogram_queries][google.cloud.talent.v4.SearchJobsRequest.histogram_queries].
  ///
  /// [google.cloud.talent.v4.SearchJobsRequest.histogram_queries]: <doc:SearchJobsRequest/histogramQueries>
  public var histogramQueryResults: [HistogramQueryResult] = []

  /// The token that specifies the starting position of the next page of results.
  /// This field is empty if there are no more results.
  public var nextPageToken: Swift.String = Swift.String()

  /// The location filters that the service applied to the specified query. If
  /// any filters are lat-lng based, the
  /// [Location.location_type][google.cloud.talent.v4.Location.location_type] is
  /// [Location.LocationType.LOCATION_TYPE_UNSPECIFIED][google.cloud.talent.v4.Location.LocationType.LOCATION_TYPE_UNSPECIFIED].
  ///
  /// [google.cloud.talent.v4.Location.LocationType.LOCATION_TYPE_UNSPECIFIED]: <doc:Location/LocationType/unspecified>
  /// [google.cloud.talent.v4.Location.location_type]: <doc:Location/locationType>
  public var locationFilters: [Location] = []

  /// Number of jobs that match the specified query.
  ///
  /// Note: This size is precise only if the total is less than 100,000.
  public var totalSize: Swift.Int32 = Swift.Int32()

  /// Additional information for the API invocation, such as the request
  /// tracking id.
  public var metadata: ResponseMetadata? = nil

  /// If query broadening is enabled, we may append additional results from the
  /// broadened query. This number indicates how many of the jobs returned in the
  /// jobs field are from the broadened query. These results are always at the
  /// end of the jobs list. In particular, a value of 0, or if the field isn't
  /// set, all the jobs in the jobs list are from the original
  /// (without broadening) query. If this field is non-zero, subsequent requests
  /// with offset after this result set should contain all broadened results.
  public var broadenedQueryJobsCount: Swift.Int32 = Swift.Int32()

  /// The spell checking result, and correction.
  public var spellCorrection: SpellingCorrection? = nil

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

  /// Job entry with metadata inside
  /// [SearchJobsResponse][google.cloud.talent.v4.SearchJobsResponse].
  ///
  /// [google.cloud.talent.v4.SearchJobsResponse]: <doc:SearchJobsResponse>
  public struct MatchingJob: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Job resource that matches the specified
    /// [SearchJobsRequest][google.cloud.talent.v4.SearchJobsRequest].
    ///
    /// [google.cloud.talent.v4.SearchJobsRequest]: <doc:SearchJobsRequest>
    public var job: Job? = nil

    /// A summary of the job with core information that's displayed on the search
    /// results listing page.
    public var jobSummary: Swift.String = Swift.String()

    /// Contains snippets of text from the
    /// [Job.title][google.cloud.talent.v4.Job.title] field most closely matching
    /// a search query's keywords, if available. The matching query keywords are
    /// enclosed in HTML bold tags.
    ///
    /// [google.cloud.talent.v4.Job.title]: <doc:Job/title>
    public var jobTitleSnippet: Swift.String = Swift.String()

    /// Contains snippets of text from the
    /// [Job.description][google.cloud.talent.v4.Job.description] and similar
    /// fields that most closely match a search query's keywords, if available.
    /// All HTML tags in the original fields are stripped when returned in this
    /// field, and matching query keywords are enclosed in HTML bold tags.
    ///
    /// [google.cloud.talent.v4.Job.description]: <doc:Job/description>
    public var searchTextSnippet: Swift.String = Swift.String()

    /// Commute information which is generated based on specified
    ///  [CommuteFilter][google.cloud.talent.v4.CommuteFilter].
    ///
    /// [google.cloud.talent.v4.CommuteFilter]: <doc:CommuteFilter>
    public var commuteInfo: SearchJobsResponse.CommuteInfo? = nil

    /// Initialize a new instance of `MatchingJob`.
    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 = MatchingJob().with { $0.job = ... }
    /// ```
    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.talent.v4.SearchJobsResponse.MatchingJob"
    }
    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)
    }
  }

  /// Commute details related to this job.
  public struct CommuteInfo: Codable, Equatable, GoogleCloudWkt._AnyPackable,
    Sendable
  {
    /// Location used as the destination in the commute calculation.
    public var jobLocation: Location? = nil

    /// The number of seconds required to travel to the job location from the
    /// query location. A duration of 0 seconds indicates that the job isn't
    /// reachable within the requested duration, but was returned as part of an
    /// expanded query.
    public var travelDuration: GoogleCloudWkt.Duration? = nil

    /// Initialize a new instance of `CommuteInfo`.
    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 = CommuteInfo().with { $0.jobLocation = ... }
    /// ```
    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.talent.v4.SearchJobsResponse.CommuteInfo"
    }
    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.talent.v4.SearchJobsResponse"
  }
  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)
  }
}
