import MenuMock from '../static/api/mock/MenuMock.js'
import Localization from '../dao/Localization.js'
export default class MainMenu {
  static getMenu () {
    var query = ` query {
        Menu(id: "mainmenu"){
            items{
                id
                titlecode
                subtitlecode
                url
                items{
                    id
                    titlecode
                    url
                }         
            }
        }`
    console.log(MenuMock.get(query))
    var menu = MenuMock.get(query)['data']['Menu']['items']
    menu.forEach(function (element, index, array) {
      element['title'] = Localization.translate(element['titlecode'])
      element['subtitle'] = Localization.translate(element['subtitlecode'])
      element['items'].forEach(function (element, index, array) {
        element['title'] = Localization.translate(element['titlecode'])
        element['subtitle'] = Localization.translate(element['subtitlecode'])
      })
    })
    return menu
  }
}
MainMenu.getMenu()
