(function (app) {
    app.config(["$stateProvider", "$urlRouterProvider", function ($stateProvider, $urlRouterProvider) {
        $stateProvider
          .state('login', {
              url: '/account/login',
              templateUrl: 'templates/account/login.html',
              controller: 'loginCtrl'
          })
         .state('register', {
             url: '/account/register',
             templateUrl: 'templates/account/register.html',
             controller: 'registerCtrl'
         })
        .state('forgetPassword', {
            url: '/account/forgetPassword',
            templateUrl: 'templates/account/forgetPassword.html',
            controller: 'forgetPasswordCtrl'
            })
          .state('wl', {
              url: '/wl',
              abstract: true,
              templateUrl: 'templates/tabs.html'
          })
         //货源管理
        .state('wl.goods', {  
            url: '/goods',
            views: {
                'wl-goods': {
                    templateUrl: 'templates/goods/index.html',
                    controller: 'goodsCtrl'
                }
            }
        })
        .state('wl.goods_add', {
            url: '/goods/add',
            views: {
                'wl-goods': {
                    templateUrl: 'templates/goods/add.html',
                    controller: 'goodsAddCtrl'
                }
            }
        })
        .state('wl.goods_detail', {
            url: '/goods/detail',
            params: { item: null },
            views: {
                'wl-goods': {
                    templateUrl: 'templates/goods/detail.html',
                    controller: 'goodsDetailCtrl'
                }
            }
        })
       .state('wl.goods_success', {
           url: '/goods/success',
                  params: { item: null },
                  views: {
                      'wl-goods': {
                          templateUrl: 'templates/goods/success.html',
                          controller: 'goodsSuccessCtrl'
                      }
                  }
              })
        //车源管理
        .state('wl.car', {
            url: '/car',
            views: {
                'wl-car': {
                    templateUrl: 'templates/car/index.html',
                    controller: 'carCtrl'
                }
            }
        })
        .state('wl.car_add', {
            url: '/car/add',
            views: {
                'wl-car': {
                    templateUrl: 'templates/car/add.html',
                    controller: 'carAddCtrl'
                }
            }
        })
        .state('wl.car_detail', {
            url: '/car/detail',
            params: { item: null },
            views: {
                'wl-car': {
                    templateUrl: 'templates/car/detail.html',
                    controller: 'carDetailCtrl'
                }
            }
        })
       .state('wl.car_success', {
           url: '/car/success',
           params: { item: null },
           views: {
               'wl-car': {
                   templateUrl: 'templates/car/success.html',
                   controller: 'carSuccessCtrl'
               }
           }
       })
        //个人中心
        .state('wl.my', {
            url: '/my',
            views: {
                'wl-my': {
                    templateUrl: 'templates/my/index.html',
                    controller: 'myCtrl'
                }
            }
        })
             .state('wl.my_profile', {
                 url: '/my/profile',
                 views: {
                     'wl-my': {
                         templateUrl: 'templates/my/profile.html',
                         controller: 'myProfileCtrl'
                     }
                 }
             })
        .state('wl.my_setting', {
            url: '/my/setting',
            views: {
                'wl-my': {
                    templateUrl: 'templates/my/setting.html',
                    controller: 'mySettingCtrl'
                }
            }
        })
        .state('wl.my_setpassword', {
            url: '/my/setpassword',
            views: {
                'wl-my': {
                    templateUrl: 'templates/my/setpassword.html',
                    controller: 'mySetPasswordCtrl'
                }
            }
        })
       .state('wl.my_truck', {
           url: '/my/truck',
            views: {
                'wl-my': {
                    templateUrl: 'templates/my/truck.html',
                    controller: 'myTruckCtrl'
                }
            }
       })
       .state('wl.my_truck_add', {
           url: '/my/truck/add',
             views: {
                 'wl-my': {
                     templateUrl: 'templates/my/truck-add.html',
                     controller: 'myTruckAddCtrl'
                 }
             }
         })
         .state('wl.my_truck_detail', {
             url: '/my/truck/detail',
             views: {
                 'wl-my': {
                     templateUrl: 'templates/my/truck-detail.html',
                     controller: 'myTruckDetailCtrl'
                 }
             }
         })
        $urlRouterProvider.otherwise('/wl/goods');
    }]);
})(angular.module('app'));