// components/services/storage/privileged/mojom/bucket_client_info.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 COMPONENTS_SERVICES_STORAGE_PRIVILEGED_MOJOM_BUCKET_CLIENT_INFO_MOJOM_SEND_VALIDATION_H_
#define COMPONENTS_SERVICES_STORAGE_PRIVILEGED_MOJOM_BUCKET_CLIENT_INFO_MOJOM_SEND_VALIDATION_H_

#include "components/services/storage/privileged/mojom/bucket_client_info.mojom-shared-internal.h"
#include "third_party/blink/public/mojom/tokens/tokens.mojom-shared.h"

#include "components/services/storage/privileged/mojom/bucket_client_info.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<::storage::mojom::BucketClientInfoDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::storage::mojom::BucketClientInfoDataView, UserType>;
  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::storage::mojom::internal::BucketClientInfo_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

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

      decltype(Traits::context_token(input)) in_context_token = Traits::context_token(input);
      mojo::internal::MessageFragment<decltype(fragment->context_token)>
          context_token_fragment(fragment.message());
      context_token_fragment.Claim(&fragment->context_token);
      
      mojo::internal::Serialize<::blink::mojom::ExecutionContextTokenDataView, send_validation>(
        in_context_token,
        context_token_fragment,
        true);

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

      decltype(Traits::document_token(input)) in_document_token = Traits::document_token(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->document_token)::BaseType> document_token_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::blink::mojom::DocumentTokenDataView, send_validation>(
        in_document_token,
        document_token_fragment);

      fragment->document_token.Set(
          document_token_fragment.is_null() ? nullptr : document_token_fragment.data());
  }
};

}  // namespace mojo::internal

#endif  // COMPONENTS_SERVICES_STORAGE_PRIVILEGED_MOJOM_BUCKET_CLIENT_INFO_MOJOM_SEND_VALIDATION_H_