import { commonConstants } from 'main_layout/src/main/ets/constants/CommonConstants';
import { TabBarItem } from './LocalBean';

/**
 * Binds data to components and provides interfaces.
 */
export class TabsViewModel {
  /**
   * Get item information for the tab.
   *
   * @return {Array<TabBarItem>} tabItems
   */
  getTabData(): TabBarItem[] {
    const tabItems: TabBarItem[] = [];
    for (let i = 0; i < commonConstants.tabSize; i++) {
      const itemInfo: TabBarItem = new TabBarItem();
      itemInfo.id = i;
      itemInfo.name = i == 0 ? $r('app.string.tab_home') : $r('app.string.tab_mine');
      itemInfo.icon = i == 0 ? $r('app.media.ic_tabs_home_normal') : $r('app.media.ic_tabs_mine_normal');
      itemInfo.selectIcon = i == 0 ? $r('app.media.ic_tabs_home_selected') : $r('app.media.ic_tabs_mine_selected');
      tabItems.push(itemInfo);
    }
    return tabItems;
  }
}

const tabsViewModel = new TabsViewModel();

export default tabsViewModel;