// third_party/blink/public/mojom/fetch/fetch_api_response.mojom-send-validation.h is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2025 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef THIRD_PARTY_BLINK_PUBLIC_MOJOM_FETCH_FETCH_API_RESPONSE_MOJOM_SEND_VALIDATION_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_FETCH_FETCH_API_RESPONSE_MOJOM_SEND_VALIDATION_H_

#include "third_party/blink/public/mojom/fetch/fetch_api_response.mojom-shared-internal.h"
#include "mojo/public/mojom/base/time.mojom-shared.h"
#include "services/network/public/mojom/auth.mojom-shared.h"
#include "services/network/public/mojom/fetch_api.mojom-shared.h"
#include "services/network/public/mojom/network_param.mojom-shared.h"
#include "services/network/public/mojom/network_types.mojom-shared.h"
#include "services/network/public/mojom/parsed_headers.mojom-shared.h"
#include "third_party/blink/public/mojom/blob/serialized_blob.mojom-shared.h"
#include "third_party/blink/public/mojom/service_worker/service_worker_error_type.mojom-shared.h"
#include "url/mojom/url.mojom-shared.h"

#include "third_party/blink/public/mojom/fetch/fetch_api_response.mojom-data-view.h"

#include "mojo/public/cpp/bindings/lib/send_validation_type.h"
#include "mojo/public/cpp/bindings/lib/send_validation.h"

namespace mojo::internal {

template <typename MaybeConstUserType, mojo::internal::SendValidation send_validation>
struct SendValidationSerializer<::blink::mojom::FetchAPIResponseDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::blink::mojom::FetchAPIResponseDataView, UserType>;
  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::blink::mojom::internal::FetchAPIResponse_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

      decltype(Traits::url_list(input)) in_url_list = Traits::url_list(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->url_list)::BaseType>
          url_list_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& url_list_validate_params =
          mojo::internal::GetArrayValidator<0, false, nullptr>();
      
      mojo::internal::Serialize<mojo::ArrayDataView<::url::mojom::UrlDataView>, send_validation>(
        in_url_list,
        url_list_fragment,
        &url_list_validate_params);

      fragment->url_list.Set(
          url_list_fragment.is_null() ? nullptr : url_list_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->url_list.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null url_list in FetchAPIResponse struct");

      fragment->status_code = Traits::status_code(input);

      decltype(Traits::status_text(input)) in_status_text = Traits::status_text(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->status_text)::BaseType> status_text_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_status_text,
        status_text_fragment);

      fragment->status_text.Set(
          status_text_fragment.is_null() ? nullptr : status_text_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->status_text.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null status_text in FetchAPIResponse struct");

      
      mojo::internal::Serialize<::network::mojom::FetchResponseType>(
        Traits::response_type(input),
        &fragment->response_type);

      fragment->padding = Traits::padding(input);

      
      mojo::internal::Serialize<::network::mojom::FetchResponseSource>(
        Traits::response_source(input),
        &fragment->response_source);

      decltype(Traits::headers(input)) in_headers = Traits::headers(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->headers)::BaseType>
          headers_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& headers_validate_params =
          mojo::internal::GetMapValidator<*&mojo::internal::GetArrayValidator<0, false, &mojo::internal::GetArrayValidator<0, false, nullptr>()>(), *&mojo::internal::GetArrayValidator<0, false, &mojo::internal::GetArrayValidator<0, false, nullptr>()>()>();
      
      mojo::internal::Serialize<mojo::MapDataView<mojo::StringDataView, mojo::StringDataView>, send_validation>(
        in_headers,
        headers_fragment,
        &headers_validate_params);

      fragment->headers.Set(
          headers_fragment.is_null() ? nullptr : headers_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->headers.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null headers in FetchAPIResponse struct");

      decltype(Traits::mime_type(input)) in_mime_type = Traits::mime_type(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->mime_type)::BaseType> mime_type_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_mime_type,
        mime_type_fragment);

      fragment->mime_type.Set(
          mime_type_fragment.is_null() ? nullptr : mime_type_fragment.data());

      decltype(Traits::request_method(input)) in_request_method = Traits::request_method(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->request_method)::BaseType> request_method_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_request_method,
        request_method_fragment);

      fragment->request_method.Set(
          request_method_fragment.is_null() ? nullptr : request_method_fragment.data());

      decltype(Traits::blob(input)) in_blob = Traits::blob(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->blob)::BaseType> blob_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::blink::mojom::SerializedBlobDataView, send_validation>(
        in_blob,
        blob_fragment);

      fragment->blob.Set(
          blob_fragment.is_null() ? nullptr : blob_fragment.data());

      
      mojo::internal::Serialize<::blink::mojom::ServiceWorkerResponseError>(
        Traits::error(input),
        &fragment->error);

      decltype(Traits::response_time(input)) in_response_time = Traits::response_time(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->response_time)::BaseType> response_time_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::mojo_base::mojom::TimeDataView, send_validation>(
        in_response_time,
        response_time_fragment);

      fragment->response_time.Set(
          response_time_fragment.is_null() ? nullptr : response_time_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->response_time.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null response_time in FetchAPIResponse struct");

      decltype(Traits::cache_storage_cache_name(input)) in_cache_storage_cache_name = Traits::cache_storage_cache_name(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->cache_storage_cache_name)::BaseType> cache_storage_cache_name_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_cache_storage_cache_name,
        cache_storage_cache_name_fragment);

      fragment->cache_storage_cache_name.Set(
          cache_storage_cache_name_fragment.is_null() ? nullptr : cache_storage_cache_name_fragment.data());

      decltype(Traits::cors_exposed_header_names(input)) in_cors_exposed_header_names = Traits::cors_exposed_header_names(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->cors_exposed_header_names)::BaseType>
          cors_exposed_header_names_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& cors_exposed_header_names_validate_params =
          mojo::internal::GetArrayValidator<0, false, &mojo::internal::GetArrayValidator<0, false, nullptr>()>();
      
      mojo::internal::Serialize<mojo::ArrayDataView<mojo::StringDataView>, send_validation>(
        in_cors_exposed_header_names,
        cors_exposed_header_names_fragment,
        &cors_exposed_header_names_validate_params);

      fragment->cors_exposed_header_names.Set(
          cors_exposed_header_names_fragment.is_null() ? nullptr : cors_exposed_header_names_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->cors_exposed_header_names.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null cors_exposed_header_names in FetchAPIResponse struct");

      decltype(Traits::side_data_blob(input)) in_side_data_blob = Traits::side_data_blob(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->side_data_blob)::BaseType> side_data_blob_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::blink::mojom::SerializedBlobDataView, send_validation>(
        in_side_data_blob,
        side_data_blob_fragment);

      fragment->side_data_blob.Set(
          side_data_blob_fragment.is_null() ? nullptr : side_data_blob_fragment.data());

      decltype(Traits::side_data_blob_for_cache_put(input)) in_side_data_blob_for_cache_put = Traits::side_data_blob_for_cache_put(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->side_data_blob_for_cache_put)::BaseType> side_data_blob_for_cache_put_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::blink::mojom::SerializedBlobDataView, send_validation>(
        in_side_data_blob_for_cache_put,
        side_data_blob_for_cache_put_fragment);

      fragment->side_data_blob_for_cache_put.Set(
          side_data_blob_for_cache_put_fragment.is_null() ? nullptr : side_data_blob_for_cache_put_fragment.data());

      decltype(Traits::parsed_headers(input)) in_parsed_headers = Traits::parsed_headers(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->parsed_headers)::BaseType> parsed_headers_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::network::mojom::ParsedHeadersDataView, send_validation>(
        in_parsed_headers,
        parsed_headers_fragment);

      fragment->parsed_headers.Set(
          parsed_headers_fragment.is_null() ? nullptr : parsed_headers_fragment.data());

      
      mojo::internal::Serialize<::network::mojom::ConnectionInfo>(
        Traits::connection_info(input),
        &fragment->connection_info);

      decltype(Traits::alpn_negotiated_protocol(input)) in_alpn_negotiated_protocol = Traits::alpn_negotiated_protocol(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->alpn_negotiated_protocol)::BaseType> alpn_negotiated_protocol_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_alpn_negotiated_protocol,
        alpn_negotiated_protocol_fragment);

      fragment->alpn_negotiated_protocol.Set(
          alpn_negotiated_protocol_fragment.is_null() ? nullptr : alpn_negotiated_protocol_fragment.data());

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->alpn_negotiated_protocol.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null alpn_negotiated_protocol in FetchAPIResponse struct");

      fragment->was_fetched_via_spdy = Traits::was_fetched_via_spdy(input);

      fragment->has_range_requested = Traits::has_range_requested(input);

      decltype(Traits::auth_challenge_info(input)) in_auth_challenge_info = Traits::auth_challenge_info(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->auth_challenge_info)::BaseType> auth_challenge_info_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::network::mojom::AuthChallengeInfoDataView, send_validation>(
        in_auth_challenge_info,
        auth_challenge_info_fragment);

      fragment->auth_challenge_info.Set(
          auth_challenge_info_fragment.is_null() ? nullptr : auth_challenge_info_fragment.data());

      fragment->request_include_credentials = Traits::request_include_credentials(input);
  }
};

}  // namespace mojo::internal

#endif  // THIRD_PARTY_BLINK_PUBLIC_MOJOM_FETCH_FETCH_API_RESPONSE_MOJOM_SEND_VALIDATION_H_