// services/shape_detection/public/mojom/barcodedetection_provider.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 SERVICES_SHAPE_DETECTION_PUBLIC_MOJOM_BARCODEDETECTION_PROVIDER_MOJOM_SEND_VALIDATION_H_
#define SERVICES_SHAPE_DETECTION_PUBLIC_MOJOM_BARCODEDETECTION_PROVIDER_MOJOM_SEND_VALIDATION_H_

#include "services/shape_detection/public/mojom/barcodedetection_provider.mojom-shared-internal.h"
#include "services/shape_detection/public/mojom/barcodedetection.mojom-shared.h"

#include "services/shape_detection/public/mojom/barcodedetection_provider.mojom-data-view.h"

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

namespace mojo::internal {

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

      decltype(Traits::formats(input)) in_formats = Traits::formats(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->formats)::BaseType>
          formats_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& formats_validate_params =
          mojo::internal::GetArrayOfEnumsValidator<0, false, ::shape_detection::mojom::internal::BarcodeFormat_Data::Validate>();
      
      mojo::internal::Serialize<mojo::ArrayDataView<::shape_detection::mojom::BarcodeFormat>, send_validation>(
        in_formats,
        formats_fragment,
        &formats_validate_params);

      fragment->formats.Set(
          formats_fragment.is_null() ? nullptr : formats_fragment.data());

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

}  // namespace mojo::internal

#endif  // SERVICES_SHAPE_DETECTION_PUBLIC_MOJOM_BARCODEDETECTION_PROVIDER_MOJOM_SEND_VALIDATION_H_