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

#include "chrome/browser/ui/side_panel/side_panel_entry_id.h"

#define SIDE_PANEL_TO_STRING_CASE_STATEMENT(entry_id, action_id, \
                                            histogram_name)      \
  case SidePanelEntryId::entry_id:                               \
    return #entry_id;
std::string SidePanelEntryIdToString(SidePanelEntryId id) {
  switch (id) { SIDE_PANEL_ENTRY_IDS(SIDE_PANEL_TO_STRING_CASE_STATEMENT) }
  NOTREACHED();
}
#undef SIDE_PANEL_TO_STRING_CASE_STATEMENT

#define SIDE_PANEL_FROM_STRING_CASE_STATEMENT(entry_id, action_id, \
                                              histogram_name)      \
  if (name == #entry_id) {                                         \
    return SidePanelEntryId::entry_id;                             \
  }
std::optional<SidePanelEntryId> SidePanelEntryIdFromString(
    std::string_view name) {
  SIDE_PANEL_ENTRY_IDS(SIDE_PANEL_FROM_STRING_CASE_STATEMENT)
  return std::nullopt;
}
#undef SIDE_PANEL_FROM_STRING_CASE_STATEMENT

#define SIDE_PANEL_HISTOGRAM_NAME_CASE_STATEMENT(entry_id, action_id, \
                                                 histogram_name)      \
  case SidePanelEntryId::entry_id:                                    \
    return histogram_name;
std::string_view SidePanelEntryIdToHistogramName(SidePanelEntryId id) {
  switch (id) { SIDE_PANEL_ENTRY_IDS(SIDE_PANEL_HISTOGRAM_NAME_CASE_STATEMENT) }
  NOTREACHED();
}
#undef SIDE_PANEL_HISTOGRAM_NAME_CASE_STATEMENT

#define SIDE_PANEL_ACTION_ID_CASE_STATEMENT(entry_id, action_id, \
                                            histogram_name)      \
  case SidePanelEntryId::entry_id:                               \
    return action_id;
std::optional<actions::ActionId> SidePanelEntryIdToActionId(
    SidePanelEntryId id) {
  switch (id) { SIDE_PANEL_ENTRY_IDS(SIDE_PANEL_ACTION_ID_CASE_STATEMENT) }
  NOTREACHED();
}
#undef SIDE_PANEL_ACTION_ID_CASE_STATEMENT
