// components/media_gallery_util/public/mojom/media_parser.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_MEDIA_GALLERY_UTIL_PUBLIC_MOJOM_MEDIA_PARSER_MOJOM_SEND_VALIDATION_H_
#define COMPONENTS_MEDIA_GALLERY_UTIL_PUBLIC_MOJOM_MEDIA_PARSER_MOJOM_SEND_VALIDATION_H_

#include "components/media_gallery_util/public/mojom/media_parser.mojom-shared-internal.h"
#include "media/mojo/mojom/media_types.mojom-shared.h"
#include "mojo/public/mojom/base/file.mojom-shared.h"
#include "mojo/public/mojom/base/time.mojom-shared.h"
#include "mojo/public/mojom/base/values.mojom-shared.h"
#include "sandbox/policy/mojom/sandbox.mojom-shared.h"

#include "components/media_gallery_util/public/mojom/media_parser.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<::chrome::mojom::ExtractVideoFrameResultDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = StructTraits<::chrome::mojom::ExtractVideoFrameResultDataView, UserType>;
  static void Serialize(
      MaybeConstUserType& input,
      mojo::internal::MessageFragment<::chrome::mojom::internal::ExtractVideoFrameResult_Data>& fragment) {
    if (CallIsNullIfExists<Traits>(input))
      return;
    fragment.Allocate();

      decltype(Traits::frame_data(input)) in_frame_data = Traits::frame_data(input);
      mojo::internal::MessageFragment<decltype(fragment->frame_data)>
          frame_data_fragment(fragment.message());
      frame_data_fragment.Claim(&fragment->frame_data);
      
      mojo::internal::Serialize<::chrome::mojom::VideoFrameDataDataView, send_validation>(
        in_frame_data,
        frame_data_fragment,
        true);

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

      decltype(Traits::config(input)) in_config = Traits::config(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->config)::BaseType> config_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::media::mojom::VideoDecoderConfigDataView, send_validation>(
        in_config,
        config_fragment);

      fragment->config.Set(
          config_fragment.is_null() ? nullptr : config_fragment.data());

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

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

      decltype(Traits::type(input)) in_type = Traits::type(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->type)::BaseType> type_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_type,
        type_fragment);

      fragment->type.Set(
          type_fragment.is_null() ? nullptr : type_fragment.data());

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

      decltype(Traits::additional_properties(input)) in_additional_properties = Traits::additional_properties(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->additional_properties)::BaseType> additional_properties_fragment(
              fragment.message());
      
      mojo::internal::Serialize<::mojo_base::mojom::DictionaryValueDataView, send_validation>(
        in_additional_properties,
        additional_properties_fragment);

      fragment->additional_properties.Set(
          additional_properties_fragment.is_null() ? nullptr : additional_properties_fragment.data());

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

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

      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());

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

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

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

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

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

      decltype(Traits::album(input)) in_album = Traits::album(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->album)::BaseType> album_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_album,
        album_fragment);

      fragment->album.Set(
          album_fragment.is_null() ? nullptr : album_fragment.data());

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

      decltype(Traits::artist(input)) in_artist = Traits::artist(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->artist)::BaseType> artist_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_artist,
        artist_fragment);

      fragment->artist.Set(
          artist_fragment.is_null() ? nullptr : artist_fragment.data());

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

      decltype(Traits::comment(input)) in_comment = Traits::comment(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->comment)::BaseType> comment_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_comment,
        comment_fragment);

      fragment->comment.Set(
          comment_fragment.is_null() ? nullptr : comment_fragment.data());

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

      decltype(Traits::copyright(input)) in_copyright = Traits::copyright(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->copyright)::BaseType> copyright_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_copyright,
        copyright_fragment);

      fragment->copyright.Set(
          copyright_fragment.is_null() ? nullptr : copyright_fragment.data());

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

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

      decltype(Traits::genre(input)) in_genre = Traits::genre(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->genre)::BaseType> genre_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_genre,
        genre_fragment);

      fragment->genre.Set(
          genre_fragment.is_null() ? nullptr : genre_fragment.data());

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

      decltype(Traits::language(input)) in_language = Traits::language(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->language)::BaseType> language_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_language,
        language_fragment);

      fragment->language.Set(
          language_fragment.is_null() ? nullptr : language_fragment.data());

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

      decltype(Traits::title(input)) in_title = Traits::title(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->title)::BaseType> title_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_title,
        title_fragment);

      fragment->title.Set(
          title_fragment.is_null() ? nullptr : title_fragment.data());

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

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

      decltype(Traits::raw_tags(input)) in_raw_tags = Traits::raw_tags(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->raw_tags)::BaseType>
          raw_tags_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& raw_tags_validate_params =
          mojo::internal::GetArrayValidator<0, false, nullptr>();
      
      mojo::internal::Serialize<mojo::ArrayDataView<::chrome::mojom::MediaStreamInfoDataView>, send_validation>(
        in_raw_tags,
        raw_tags_fragment,
        &raw_tags_validate_params);

      fragment->raw_tags.Set(
          raw_tags_fragment.is_null() ? nullptr : raw_tags_fragment.data());

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

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

      decltype(Traits::type(input)) in_type = Traits::type(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->type)::BaseType> type_fragment(
              fragment.message());
      
      mojo::internal::Serialize<mojo::StringDataView, send_validation>(
        in_type,
        type_fragment);

      fragment->type.Set(
          type_fragment.is_null() ? nullptr : type_fragment.data());

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

      decltype(Traits::data(input)) in_data = Traits::data(input);
      mojo::internal::MessageFragment<
          typename decltype(fragment->data)::BaseType>
          data_fragment(fragment.message());
      constexpr const mojo::internal::ContainerValidateParams& data_validate_params =
          mojo::internal::GetArrayValidator<0, false, nullptr>();
      
      mojo::internal::Serialize<mojo::ArrayDataView<uint8_t>, send_validation>(
        in_data,
        data_fragment,
        &data_validate_params);

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

      
      MOJO_INTERNAL_CHECK_SERIALIZATION(
        send_validation,
        !(fragment->data.is_null()),
        mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
        "null data in AttachedImage struct");
  }
};
template <typename MaybeConstUserType, SendValidation send_validation>
struct SendValidationSerializer<::chrome::mojom::VideoFrameDataDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = UnionTraits<::chrome::mojom::VideoFrameDataDataView, UserType>;
  static void Serialize(MaybeConstUserType& input,
                        MessageFragment<::chrome::mojom::internal::VideoFrameData_Data>& fragment,
                        bool inlined) {
    
    if (CallIsNullIfExists<Traits>(input)) {
       if (inlined)
        fragment->set_null();
      return;
    }

if (!inlined)
  fragment.Allocate();

    // TODO(azani): Handle unknown and objects.
    // Set the not-null flag.
fragment->size = kUnionDataSize;
fragment->tag = Traits::GetTag(input);
switch (fragment->tag) {
  case ::chrome::mojom::VideoFrameDataDataView::Tag::kEncodedData: {
    decltype(Traits::encoded_data(input))
    in_encoded_data = Traits::encoded_data(input);
    mojo::internal::MessageFragment<
      typename decltype(fragment->data.f_encoded_data)::BaseType>
    value_fragment(fragment.message());
        constexpr const mojo::internal::ContainerValidateParams& encoded_data_validate_params =
            mojo::internal::GetArrayValidator<0, false, nullptr>();
        
mojo::internal::Serialize<mojo::ArrayDataView<uint8_t>, send_validation>(
  in_encoded_data,
  value_fragment,
  &encoded_data_validate_params);
  
MOJO_INTERNAL_CHECK_SERIALIZATION(
  send_validation,
  !(value_fragment.is_null()),
  mojo::internal::VALIDATION_ERROR_UNEXPECTED_NULL_POINTER,
  "null encoded_data in VideoFrameData union");
    fragment->data.f_encoded_data.Set(
      value_fragment.is_null() ? nullptr : value_fragment.data());
    break;
  }
  case ::chrome::mojom::VideoFrameDataDataView::Tag::kDecodedFrame: {
    decltype(Traits::decoded_frame(input))
    in_decoded_frame = Traits::decoded_frame(input);
    mojo::internal::MessageFragment<
      typename decltype(fragment->data.f_decoded_frame)::BaseType>
    value_fragment(fragment.message());
        
mojo::internal::Serialize<::media::mojom::VideoFrameDataView, send_validation>(
  in_decoded_frame,
  value_fragment);
    fragment->data.f_decoded_frame.Set(
      value_fragment.is_null() ? nullptr : value_fragment.data());
    break;
  }
}
  }
};

}  // namespace mojo::internal

#endif  // COMPONENTS_MEDIA_GALLERY_UTIL_PUBLIC_MOJOM_MEDIA_PARSER_MOJOM_SEND_VALIDATION_H_