import { iconsExistList } from "@/components/MobileUiBuilder/AndroidUI/AndroidConfiguration";
import { StringCaser } from "@/components/WebExportReact/src/utils/helpers";

{
  /* <group android:checkableBehavior="single"> */
}
export default (name, menu) => {
  return `<menu xmlns:android="http://schemas.android.com/apk/res/android">
    ${buildMenuItems(menu)}

    <item
    android:id="@+id/alerts"
    android:title="Alerts"
    android:visible="false"

          </menu>
          `;
};

const buildMenuItems = (items) => {
  if (typeof items === "undefined") return ""
  const content = [];
  for (const item of items) {
    content.push(` <item
            android:id="@+id/${item.destination ?? "home"}"
            android:title="${item.title}"
            android:icon="${iconsExistList.includes(item.icon) ? "@drawable/" + item.icon : "@android:drawable/" + item.icon}"
             />
            `);
  }
  return content.join("\n");
};
// </group>
