#ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_PAYMENTS_PAYMENTS_SYNC_BRIDGE_UTIL_H_
#define COMPONENTS_AUTOFILL_CORE_BROWSER_WEBDATA_PAYMENTS_PAYMENTS_SYNC_BRIDGE_UTIL_H_
#include <memory>
#include <string>
#include "components/autofill/core/browser/data_model/credit_card_benefit.h"
#include "components/sync/model/entity_change.h"
#include "components/sync/protocol/autofill_wallet_credential_specifics.pb.h"
namespace autofill {
class AutofillOfferData;
struct ServerCvc;
class AutofillWalletUsageData;
class BankAccount;
class CreditCard;
struct CreditCardCloudTokenData;
class Iban;
class PaymentsAutofillTable;
struct PaymentsCustomerData;
class VirtualCardUsageData;
std::string GetStorageKeyForWalletMetadataTypeAndSpecificsId(
sync_pb::WalletMetadataSpecifics::Type type,
const std::string& specifics_id);
void SetAutofillWalletSpecificsFromServerCard(
const CreditCard& card,
sync_pb::AutofillWalletSpecifics* wallet_specifics,
bool enforce_utf8 = false);
void SetAutofillWalletSpecificsFromPaymentsCustomerData(
const PaymentsCustomerData& customer_data,
sync_pb::AutofillWalletSpecifics* wallet_specifics);
void SetAutofillWalletSpecificsFromCreditCardCloudTokenData(
const CreditCardCloudTokenData& cloud_token_data,
sync_pb::AutofillWalletSpecifics* wallet_specifics,
bool enforce_utf8 = false);
void SetAutofillWalletSpecificsFromMaskedIban(
const Iban& iban,
sync_pb::AutofillWalletSpecifics* wallet_specifics,
bool enforce_utf8 = false);
void SetAutofillWalletSpecificsFromCardBenefit(
const CreditCardBenefit& benefit,
bool enforce_utf8,
sync_pb::AutofillWalletSpecifics& wallet_specifics);
void SetAutofillWalletUsageSpecificsFromAutofillWalletUsageData(
const AutofillWalletUsageData& wallet_usage_data,
sync_pb::AutofillWalletUsageSpecifics* wallet_usage_specifics);
void SetAutofillOfferSpecificsFromOfferData(
const AutofillOfferData& offer_data,
sync_pb::AutofillOfferSpecifics* offer_specifics);
AutofillOfferData AutofillOfferDataFromOfferSpecifics(
const sync_pb::AutofillOfferSpecifics& offer_specifics);
sync_pb::AutofillWalletCredentialSpecifics
AutofillWalletCredentialSpecificsFromStructData(const ServerCvc& server_cvc);
ServerCvc AutofillWalletCvcStructDataFromWalletCredentialSpecifics(
const sync_pb::AutofillWalletCredentialSpecifics&
wallet_credential_specifics);
VirtualCardUsageData VirtualCardUsageDataFromUsageSpecifics(
const sync_pb::AutofillWalletUsageSpecifics& usage_specifics);
BankAccount BankAccountFromWalletSpecifics(
const sync_pb::PaymentInstrument& payment_instrument);
void SetAutofillWalletSpecificsFromBankAccount(
const BankAccount& bank_account,
sync_pb::AutofillWalletSpecifics* wallet_specifics);
void CopyRelevantWalletMetadataAndCvc(
const PaymentsAutofillTable& table,
std::vector<CreditCard>* cards_from_server);
void PopulateWalletTypesFromSyncData(
const ::syncer::EntityChangeList& entity_data,
std::vector<CreditCard>& wallet_cards,
std::vector<Iban>& wallet_ibans,
std::vector<PaymentsCustomerData>& customer_data,
std::vector<CreditCardCloudTokenData>& cloud_token_data,
std::vector<BankAccount>& bank_accounts,
std::vector<CreditCardBenefit>& benefits,
std::vector<sync_pb::PaymentInstrument>& payment_instruments);
template <class Item>
bool AreAnyItemsDifferent(const std::vector<std::unique_ptr<Item>>& old_data,
const std::vector<Item>& new_data);
template <class Item>
bool AreAnyItemsDifferent(const std::vector<Item>& old_data,
const std::vector<Item>& new_data);
bool IsVirtualCardUsageDataSpecificsValid(
const sync_pb::AutofillWalletUsageSpecifics::VirtualCardUsageData&
specifics);
bool IsOfferSpecificsValid(const sync_pb::AutofillOfferSpecifics specifics);
bool IsVirtualCardUsageDataSet(
const VirtualCardUsageData& virtual_card_usage_data);
bool IsAutofillWalletCredentialDataSpecificsValid(
const sync_pb::AutofillWalletCredentialSpecifics&
wallet_credential_specifics);
bool AreMaskedBankAccountSupported();
bool IsEwalletAccountSupported();
}
#endif