// Copyright 2026 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_AUTOFILL_ANDROID_ENTITY_INSTANCE_WITH_LABELS_H_
#define CHROME_BROWSER_AUTOFILL_ANDROID_ENTITY_INSTANCE_WITH_LABELS_H_

#include <optional>
#include <string>

#include "base/android/jni_android.h"
#include "base/android/scoped_java_ref.h"
#include "chrome/browser/autofill/android/entity_type_android.h"
#include "third_party/jni_zero/jni_zero.h"

namespace autofill {

// The C++ counterpart to the Java class of the same name.
struct EntityInstanceWithLabels {
  EntityInstanceWithLabels(std::string guid,
                           EntityTypeAndroid entity_type,
                           std::u16string entity_instance_label,
                           std::u16string entity_instance_sublabel,
                           bool stored_in_wallet,
                           std::optional<std::string> wallet_entity_url);
  ~EntityInstanceWithLabels();
  EntityInstanceWithLabels(const EntityInstanceWithLabels&);
  EntityInstanceWithLabels& operator=(const EntityInstanceWithLabels&);
  EntityInstanceWithLabels(EntityInstanceWithLabels&&);
  EntityInstanceWithLabels& operator=(EntityInstanceWithLabels&&);

  std::string guid;
  EntityTypeAndroid entity_type;
  std::u16string entity_instance_label;
  std::u16string entity_instance_sublabel;
  bool stored_in_wallet;
  std::optional<std::string> wallet_entity_url;
};

}  // namespace autofill

namespace jni_zero {

template <>
autofill::EntityInstanceWithLabels
FromJniType<autofill::EntityInstanceWithLabels>(JNIEnv* env,
                                                const JavaRef<jobject>& jobj);

template <>
ScopedJavaLocalRef<jobject> ToJniType<autofill::EntityInstanceWithLabels>(
    JNIEnv* env,
    const autofill::EntityInstanceWithLabels& native_instance);

}  // namespace jni_zero

#endif  // CHROME_BROWSER_AUTOFILL_ANDROID_ENTITY_INSTANCE_WITH_LABELS_H_
