/** @ngInject */
export default function ($stateProvider, $urlRouterProvider, $locationProvider) {
  $locationProvider.html5Mode({
    enabled: false,
    requireBase: false
  });

  $urlRouterProvider.otherwise('/user/info/phones');

  $urlRouterProvider.when('/user/phones/{id}', '/user/phones/{id}/description');

  $stateProvider
    .state('app', {
      abstract: true,
      url: '/',
      views: {
        'header': {template: '<vm-header></vm-header>'},
        'footer': {template: '<vm-footer></vm-footer>'}
      }
    })

    .state('app.admin', {
      abstract: true,
      url: 'admin',
      resolve: {
        /** @ngInject */
        loadAdminModule: function ($ocLazyLoad) {
          return $ocLazyLoad.load('appAdmin');
        }
      }
    })

    .state('app.admin.settings', {
      url: '/settings',
      views: {
        'content@': {template: '<settings></settings>'}
      }
    })

    .state('app.user', {
      abstract: true,
      url: 'user',
      views: {
        'sidebar@': {template: '<vm-sidebar></vm-sidebar>'}
      }
    })

    .state('app.user.info', {
      url: '/info',
      views: {
        'sidebar@': {},
      }
    })

    .state('app.user.info.phones', {
      url: '/phones',
      views: {
        'content@': {template: '<phones></phones>'}
      }
    })

    .state('app.user.phones', {
      abstract: true,
      url: '/phones'
    })

    .state('app.user.phones.id', {
      url: '/:id',
      views: {
        'content@': {template: '<phone></phone>'}
      }
    })

    .state('app.user.phones.id.description', {
      url: '/description',
      views: {
        'tab-content': {template: '<phone-description></phone-description>'}
      }
    })

    .state('app.user.phones.id.characteristics', {
      url: '/characteristics',
      views: {
        'tab-content': {template: '<phone-characteristics></phone-characteristics>'}
      }
    })

    .state('app.user.phones.id.reviews', {
      url: '/reviews',
      views: {
        'tab-content': {template: '<phone-reviews></phone-reviews>'}
      }
    });
}