// third_party/blink/public/mojom/permissions_policy/policy_value.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_PERMISSIONS_POLICY_POLICY_VALUE_MOJOM_SEND_VALIDATION_H_
#define THIRD_PARTY_BLINK_PUBLIC_MOJOM_PERMISSIONS_POLICY_POLICY_VALUE_MOJOM_SEND_VALIDATION_H_

#include "third_party/blink/public/mojom/permissions_policy/policy_value.mojom-shared-internal.h"

#include "third_party/blink/public/mojom/permissions_policy/policy_value.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/has_send_validation_helper.h"

namespace mojo::internal {
template <typename MaybeConstUserType>
struct HasSendValidationSerialize<::blink::mojom::PolicyValueType, MaybeConstUserType>
    : std::false_type {};
template <typename MaybeConstUserType, SendValidation send_validation>
struct SendValidationSerializer<::blink::mojom::PolicyValueDataView, MaybeConstUserType, send_validation> {
  using UserType = typename std::remove_const<MaybeConstUserType>::type;
  using Traits = UnionTraits<::blink::mojom::PolicyValueDataView, UserType>;
  static void Serialize(MaybeConstUserType& input,
                        MessageFragment<::blink::mojom::internal::PolicyValue_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 ::blink::mojom::PolicyValueDataView::Tag::kBoolValue: {
    decltype(Traits::bool_value(input))
    in_bool_value = Traits::bool_value(input);
    fragment->data.f_bool_value = in_bool_value;
    break;
  }
  case ::blink::mojom::PolicyValueDataView::Tag::kDecDoubleValue: {
    decltype(Traits::dec_double_value(input))
    in_dec_double_value = Traits::dec_double_value(input);
    fragment->data.f_dec_double_value = in_dec_double_value;
    break;
  }
  case ::blink::mojom::PolicyValueDataView::Tag::kEnumValue: {
    decltype(Traits::enum_value(input))
    in_enum_value = Traits::enum_value(input);
    fragment->data.f_enum_value = in_enum_value;
    break;
  }
}
  }
};

}  // namespace mojo::internal

#endif  // THIRD_PARTY_BLINK_PUBLIC_MOJOM_PERMISSIONS_POLICY_POLICY_VALUE_MOJOM_SEND_VALIDATION_H_