// components/omnibox/browser/fusebox_action.mojom.h is auto generated by mojom_bindings_generator.py, do not edit

// Copyright 2013 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_OMNIBOX_BROWSER_FUSEBOX_ACTION_MOJOM_H_
#define COMPONENTS_OMNIBOX_BROWSER_FUSEBOX_ACTION_MOJOM_H_

#include <stdint.h>

#include <limits>
#include <optional>
#include <type_traits>
#include <utility>
#include "mojo/public/cpp/bindings/clone_traits.h"
#include "mojo/public/cpp/bindings/equals_traits.h"
#include "mojo/public/cpp/bindings/struct_ptr.h"
#include "mojo/public/cpp/bindings/struct_traits.h"
#include "mojo/public/cpp/bindings/union_traits.h"
#include "mojo/public/cpp/bindings/lib/serialization.h"

#include "third_party/perfetto/include/perfetto/tracing/traced_value_forward.h"

#include "components/omnibox/browser/fusebox_action.mojom-features.h"  // IWYU pragma: export
#include "components/omnibox/browser/fusebox_action.mojom-shared.h"  // IWYU pragma: export
#include "components/omnibox/browser/fusebox_action.mojom-forward.h"  // IWYU pragma: export
#include "components/omnibox/composebox/composebox_query.mojom.h"
#include <string>
#include <vector>




#include "components/omnibox/browser/fusebox_action_mojom_traits.h"




namespace fusebox_action::mojom {








class  FuseboxAction {
 public:
  template <typename T>
  using EnableIfSame = std::enable_if_t<std::is_same<FuseboxAction, T>::value>;
  using DataView = FuseboxActionDataView;
  using Data_ = internal::FuseboxAction_Data;

  template <typename... Args>
  static FuseboxActionPtr New(Args&&... args) {
    return FuseboxActionPtr(
        std::in_place, std::forward<Args>(args)...);
  }

  template <typename U>
  static FuseboxActionPtr From(const U& u) {
    return mojo::TypeConverter<FuseboxActionPtr, U>::Convert(u);
  }

  template <typename U>
  U To() const {
    return mojo::TypeConverter<U, FuseboxAction>::Convert(*this);
  }


  FuseboxAction();

  FuseboxAction(
      std::optional<::omnibox::ToolMode> preselected_tool,
      std::optional<::omnibox::SuggestInventory> preferred_inventory,
      std::optional<::omnibox::ModelMode> preselected_model,
      std::optional<QueryActionOverride> query_action_override,
      std::optional<InputSource> preselected_input_source,
      std::optional<SearchboxOverride> searchbox_override);


  ~FuseboxAction();

  // Clone() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Clone() or copy
  // constructor/assignment are available for members.
  template <typename StructPtrType = FuseboxActionPtr>
  FuseboxActionPtr Clone() const;

  // Equals() is a template so it is only instantiated if it is used. Thus, the
  // bindings generator does not need to know whether Equals() or == operator
  // are available for members.
  template <typename T, FuseboxAction::EnableIfSame<T>* = nullptr>
  bool Equals(const T& other) const;

  template <typename T, FuseboxAction::EnableIfSame<T>* = nullptr>
  bool operator==(const T& rhs) const { return Equals(rhs); }

  template <typename T, FuseboxAction::EnableIfSame<T>* = nullptr>
  bool operator!=(const T& rhs) const { return !operator==(rhs); }

  template <mojo::internal::SendValidation send_validation, typename UserType>
  static std::vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        FuseboxAction::DataView, std::vector<uint8_t>, send_validation>(input);
  }

  template <typename UserType>
  static std::vector<uint8_t> Serialize(UserType* input) {
    return mojo::internal::SerializeImpl<
        FuseboxAction::DataView, std::vector<uint8_t>>(input);
  }

  template <typename UserType>
  static mojo::Message SerializeAsMessage(UserType* input) {
    return mojo::internal::SerializeAsMessageImpl<
        FuseboxAction::DataView>(input);
  }

  // The returned Message is serialized only if the message is moved
  // cross-process or cross-language. Otherwise if the message is Deserialized
  // as the same UserType |input| will just be moved to |output| in
  // DeserializeFromMessage.
  template <typename UserType>
  static mojo::Message WrapAsMessage(UserType input) {
    return mojo::Message(std::make_unique<
        internal::FuseboxAction_UnserializedMessageContext<
            UserType, FuseboxAction::DataView>>(0, 0, std::move(input)),
        MOJO_CREATE_MESSAGE_FLAG_NONE);
  }

  template <typename UserType>
  static bool Deserialize(const void* data,
                          size_t data_num_bytes,
                          UserType* output) {
    mojo::Message message;
    return mojo::internal::DeserializeImpl<FuseboxAction::DataView>(
        message, data, data_num_bytes, output, Validate);
  }

  template <typename UserType>
  static bool Deserialize(base::span<const uint8_t> input,
                          UserType* output) {
    return FuseboxAction::Deserialize(
        input.empty() ? nullptr : input.data(), input.size(), output);
  }

  template <typename UserType>
  static bool DeserializeFromMessage(mojo::Message input,
                                     UserType* output) {
    auto context = input.TakeUnserializedContext<
        internal::FuseboxAction_UnserializedMessageContext<
            UserType, FuseboxAction::DataView>>();
    if (context) {
      *output = std::move(context->TakeData());
      return true;
    }
    input.SerializeIfNecessary();
    return mojo::internal::DeserializeImpl<FuseboxAction::DataView>(
        input, input.payload(), input.payload_num_bytes(), output, Validate);
  }

  
  std::optional<::omnibox::ToolMode> preselected_tool;
  
  std::optional<::omnibox::SuggestInventory> preferred_inventory;
  
  std::optional<::omnibox::ModelMode> preselected_model;
  
  std::optional<QueryActionOverride> query_action_override;
  
  std::optional<InputSource> preselected_input_source;
  
  std::optional<SearchboxOverride> searchbox_override;

  // Serialise this struct into a trace.
  void WriteIntoTrace(perfetto::TracedValue traced_context) const;

 private:
  static bool Validate(const void* data,
                       mojo::internal::ValidationContext* validation_context);
};

// The comparison operators are templates, so they are only instantiated if they
// are used. Thus, the bindings generator does not need to know whether
// comparison operators are available for members.
template <typename T, FuseboxAction::EnableIfSame<T>* = nullptr>
bool operator<(const T& lhs, const T& rhs);

template <typename T, FuseboxAction::EnableIfSame<T>* = nullptr>
bool operator<=(const T& lhs, const T& rhs) {
  return !(rhs < lhs);
}

template <typename T, FuseboxAction::EnableIfSame<T>* = nullptr>
bool operator>(const T& lhs, const T& rhs) {
  return rhs < lhs;
}

template <typename T, FuseboxAction::EnableIfSame<T>* = nullptr>
bool operator>=(const T& lhs, const T& rhs) {
  return !(lhs < rhs);
}

template <typename StructPtrType>
FuseboxActionPtr FuseboxAction::Clone() const {
  return New(
      mojo::Clone(preselected_tool),
      mojo::Clone(preferred_inventory),
      mojo::Clone(preselected_model),
      mojo::Clone(query_action_override),
      mojo::Clone(preselected_input_source),
      mojo::Clone(searchbox_override)
  );
}

template <typename T, FuseboxAction::EnableIfSame<T>*>
bool FuseboxAction::Equals(const T& other_struct) const {
  if (!mojo::Equals(this->preselected_tool, other_struct.preselected_tool))
    return false;
  if (!mojo::Equals(this->preferred_inventory, other_struct.preferred_inventory))
    return false;
  if (!mojo::Equals(this->preselected_model, other_struct.preselected_model))
    return false;
  if (!mojo::Equals(this->query_action_override, other_struct.query_action_override))
    return false;
  if (!mojo::Equals(this->preselected_input_source, other_struct.preselected_input_source))
    return false;
  if (!mojo::Equals(this->searchbox_override, other_struct.searchbox_override))
    return false;
  return true;
}

template <typename T, FuseboxAction::EnableIfSame<T>*>
bool operator<(const T& lhs, const T& rhs) {
  if (lhs.preselected_tool < rhs.preselected_tool)
    return true;
  if (rhs.preselected_tool < lhs.preselected_tool)
    return false;
  if (lhs.preferred_inventory < rhs.preferred_inventory)
    return true;
  if (rhs.preferred_inventory < lhs.preferred_inventory)
    return false;
  if (lhs.preselected_model < rhs.preselected_model)
    return true;
  if (rhs.preselected_model < lhs.preselected_model)
    return false;
  if (lhs.query_action_override < rhs.query_action_override)
    return true;
  if (rhs.query_action_override < lhs.query_action_override)
    return false;
  if (lhs.preselected_input_source < rhs.preselected_input_source)
    return true;
  if (rhs.preselected_input_source < lhs.preselected_input_source)
    return false;
  if (lhs.searchbox_override < rhs.searchbox_override)
    return true;
  if (rhs.searchbox_override < lhs.searchbox_override)
    return false;
  return false;
}


}  // fusebox_action::mojom

namespace mojo {


template <>
struct  StructTraits<::fusebox_action::mojom::FuseboxAction::DataView,
                                         ::fusebox_action::mojom::FuseboxActionPtr> {
  static bool IsNull(const ::fusebox_action::mojom::FuseboxActionPtr& input) { return !input; }
  static void SetToNull(::fusebox_action::mojom::FuseboxActionPtr* output) { output->reset(); }

  static decltype(::fusebox_action::mojom::FuseboxAction::preselected_tool) preselected_tool(
      const ::fusebox_action::mojom::FuseboxActionPtr& input) {
    return input->preselected_tool;
  }

  static decltype(::fusebox_action::mojom::FuseboxAction::preferred_inventory) preferred_inventory(
      const ::fusebox_action::mojom::FuseboxActionPtr& input) {
    return input->preferred_inventory;
  }

  static decltype(::fusebox_action::mojom::FuseboxAction::preselected_model) preselected_model(
      const ::fusebox_action::mojom::FuseboxActionPtr& input) {
    return input->preselected_model;
  }

  static decltype(::fusebox_action::mojom::FuseboxAction::query_action_override) query_action_override(
      const ::fusebox_action::mojom::FuseboxActionPtr& input) {
    return input->query_action_override;
  }

  static decltype(::fusebox_action::mojom::FuseboxAction::preselected_input_source) preselected_input_source(
      const ::fusebox_action::mojom::FuseboxActionPtr& input) {
    return input->preselected_input_source;
  }

  static decltype(::fusebox_action::mojom::FuseboxAction::searchbox_override) searchbox_override(
      const ::fusebox_action::mojom::FuseboxActionPtr& input) {
    return input->searchbox_override;
  }

  static bool Read(::fusebox_action::mojom::FuseboxAction::DataView input, ::fusebox_action::mojom::FuseboxActionPtr* output);
};

}  // namespace mojo

#endif  // COMPONENTS_OMNIBOX_BROWSER_FUSEBOX_ACTION_MOJOM_H_