import { defineConfig } from 'vitepress'
import { tabsMarkdownPlugin } from 'vitepress-plugin-tabs'
import { overrideComponents } from './override-components'

const gitlab = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
   viewBox="0 0 380 380"
   version="1.1"
   id="svg578"
   xmlns="http://www.w3.org/2000/svg"
   xmlns:svg="http://www.w3.org/2000/svg">
  <defs
     id="defs567">
    <style
       id="style565">.cls-1{fill:#e24329;}.cls-2{fill:#fc6d26;}.cls-3{fill:#fca326;}</style>
  </defs>
  <path
     class="cls-1"
     d="m 358.48029,150.34002 -0.48818,-1.24758 -47.26334,-123.347555 a 12.313059,12.313059 0 0 0 -4.86375,-5.858196 12.656595,12.656595 0 0 0 -14.46468,0.777477 12.656595,12.656595 0 0 0 -4.19476,6.364459 l -31.9127,97.636595 H 126.06904 L 94.156344,27.028625 a 12.403463,12.403463 0 0 0 -4.194757,-6.38254 12.656595,12.656595 0 0 0 -14.46468,-0.777477 12.421544,12.421544 0 0 0 -4.863748,5.858196 L 23.279412,149.02012 22.80931,150.2677 a 87.764446,87.764446 0 0 0 29.110169,101.43357 l 0.162727,0.12656 0.433941,0.30738 71.997943,53.91709 35.61928,26.95855 21.69702,16.38125 a 14.591246,14.591246 0 0 0 17.64691,0 l 21.69702,-16.38125 35.61927,-26.95855 72.43189,-54.24255 0.1808,-0.14464 a 87.800608,87.800608 0 0 0 29.07401,-101.32509 z"
     id="path569"
     style="stroke-width:1.80808" />
  <path
     class="cls-2"
     d="m 358.48029,150.34002 -0.48818,-1.24758 a 159.65391,159.65391 0 0 0 -63.55419,28.56775 l -103.80216,78.48897 c 35.34806,26.74157 66.12167,49.97547 66.12167,49.97547 l 72.43188,-54.24255 0.18081,-0.14465 a 87.800608,87.800608 0 0 0 29.11017,-101.39741 z"
     id="path571"
     style="stroke-width:1.80808" />
  <path
     class="cls-3"
     d="m 124.51409,306.12463 35.61928,26.95854 21.69702,16.38125 a 14.591246,14.591246 0 0 0 17.64691,0 l 21.69702,-16.38125 35.61927,-26.95854 c 0,0 -30.80977,-23.30622 -66.15783,-49.97547 -35.34806,26.66925 -66.12167,49.97547 -66.12167,49.97547 z"
     id="path573"
     style="stroke-width:1.80808" />
  <path
     class="cls-2"
     d="M 86.815519,177.66019 A 159.45502,159.45502 0 0 0 23.279412,149.02012 l -0.470102,1.24758 a 87.764446,87.764446 0 0 0 29.110169,101.43357 l 0.162727,0.12656 0.433941,0.30738 71.997943,53.91709 c 0,0 30.73745,-23.23389 66.12167,-49.97547 z"
     id="path575"
     style="stroke-width:1.80808" />
</svg>
`

const new_version = process.env?.VITE_NEW_VERSION;
console.log({ base: typeof new_version !== 'undefined' ? '/' : '/docs/' })

// https://vitepress.dev/reference/site-config
export default defineConfig({
  title: "Beeline Cloud",
  description: "Документация Beeline Cloud",
  head: [['link', { rel: 'icon', type: 'image/png', sizes: '32x32', href: '/bee-favicon.png' }]],
  base: typeof new_version !== 'undefined' ? '/' : '/docs/',
  markdown: {
    config(md) {
      md.use(tabsMarkdownPlugin)
    }
  },
  vite: {
    resolve: {
      alias: overrideComponents(),
    }
  },
  locales: {
    root: {
      label: 'Русский',
      lang: 'ru',
    }
  },
  themeConfig: {
    logo: '/favicon.svg',
    search: {
      provider: 'local',
      options: {
        locales: {
          root: {
            translations: {
              button: {
                buttonText: 'Поиск',
                buttonAriaLabel: 'Поиск'
              },
              modal: {
                noResultsText: 'Нет результатов для',
                resetButtonTitle: 'Сбросить',
                displayDetails: 'Показать расширенный список',
                footer: {
                  selectText: 'Выбрать',
                  closeText: 'Закрыть',
                  navigateText: 'Перейти',
                }
              }
            }
          }
        }
      }
    },
    // https://vitepress.dev/reference/default-theme-config
  // nav: [
  //   ],

    //  socialLinks: [
    //    { icon: { svg: gitlab }, link: 'https://git.vimpelcom.ru/common/vega/docs' }
    //  ],

    // editLink: {
    //   pattern: 'https://git.vimpelcom.ru/-/ide/project/common/vega/docs/edit/develop/-/src/:path',
    //   text: 'Отредактируйте эту страницу на GitLab'
    // },

    docFooter: {
      next: 'Вперед',
      prev: 'Назад'
    },

    // lastUpdated: {
    //   text: 'Обновлена',
    //   formatOptions: {
    //     dateStyle: 'long',
    //   }
    // },

    outline: {
      label: 'Содержание'
    },
    sidebar: {
    '/platform/': [
      {
        text: 'Платформа Beeline Cloud', link: '/platform/index.md',
        collapsed: true,
          items: [
            {text: 'Сервисы', link: '/platform/services/services.md'},
            {text: 'Техническая поддержка', link: '/platform/support/support-overview.md'}, 
          ],
        },
      ],
    '/start/': [
      {
        text: 'Начало работы в Beeline Cloud', link: '/start/index.md',
        collapsed: true,
          items: [
            {text: 'Начать работу', link: '/start/getting-started.md'},
            {text: 'Бесплатный период', link: '/start/trial.md'}, 
            {text: 'Платное использование', link: '/start/organization.md'},
          ],
        },
      ],
    //  '/billing/': [
 
    //   ],
      '/vdc/': [
        {
        text: 'Виртуальные дата-центры на VMware', link: '/vdc/index.md',
        collapsed: true,
          items: [
            {text: 'Обзор сервиса', link: '/vdc/vdc-overview.md'},
            {text: 'Быстрый старт', link: '/vdc/vdc-getting-started.md'}, 
            {text: 'Виртуальные дата-центры', link: '/vdc/vdc-how-to/vdc-index.md',
            collapsed: true,
            items: [
            { text: 'Создание дата-центра', link: '/vdc/vdc-how-to/vdc-create.md' },
            { text: 'Вход в дата-центр', link: '/vdc/vdc-how-to/vdc-enter.md' },
            { text: 'Управление дата-центром', link: '/vdc/vdc-how-to/vdc-manage.md' },
            { text: 'Двухфакторная аутентификация', link: '/vdc/vdc-how-to/vdc-2fa.md', 
              collapsed: true,
              items: [
              {text: 'Подключение 2FA', link: '/vdc/vdc-how-to/vdc-2fa-start.md'},
              {text: 'Управление 2FA', link: '/vdc/vdc-how-to/vdc-2fa-manage.md'},      
              ],  
            },
           ],
          },
           // { text: 'Тарификация', link: '/vdc/vdc-tarif.md' },
          ],
        },
       ],
      '/compute/': [
        {
        text: 'Виртуальные машины', link: '/compute/index.md',
        collapsed: true,
          items: [
            {text: 'Обзор сервиса', link: '/compute/compute-overview.md'},
          //  {text: 'Быстрый старт', link: '/compute/compute-getting-started.md'}, 
            {text: 'Виртуальные машины', link: '/compute/compute-how-to/compute-index.md',
                collapsed: true,
                items: [
                { text: 'Создание ВМ', link: '/compute/compute-how-to/compute-servers-create.md' },
                { text: 'Подключение к ВМ', link: '/compute/compute-how-to/compute-connect.md' },
                { text: 'Управление ВМ', link: '/compute/compute-how-to/compute-servers-manage.md' },
                ],
              },
            { text: 'Диски', link: '/compute/compute-how-to/compute-disks.md' },
            { text: 'IP-адреса', link: '/compute/compute-how-to/compute-ip.md' },
            { text: 'Группы размещения', link: '/compute/compute-how-to/compute-affinity.md' },  
          ],
        },
       
          ],
      '/admin/': [
      {
        text: 'Аккаунт Beeline Cloud', link: '/admin/acc-index.md',
        collapsed: true,
          items: [
            {text: 'Управление ключевыми парами', link: '/admin/ssh.md'},
          ],
        },
      ],    
      },  
    },
  }
)
