import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ProductComponent } from './product/product.component';
import { RouterModule, Routes } from '@angular/router';
import { ProductDetailComponent } from './product-detail/product-detail.component';
import { CartComponent } from './cart/cart.component';
import { SalesAppbarComponent } from './components/sales-appbar/sales-appbar.component';
import { SaleCustomerComponent } from './sale-customer/sale-customer.component';
import { MenuCustomerComponent } from './menu-customer/menu-customer.component';
import { PageSalesComponent } from './page-sales/page-sales.component';
import { MenuSalesComponent } from './menu-sales/menu-sales.component';
import { ListCustomerComponent } from './customer/list-customer/list-customer.component';
import { OrderComponent } from './order/order.component';
import { ProductCardComponent } from './components/product-card/product-card.component';
import { ProductListComponent } from './product-list/product-list.component';
import { HomeSalesComponent } from './home-sales/home-sales.component';
import { DashSalesComponent } from './pages/dash-sales/dash-sales.component';
import { CartSalesComponent } from './cart-sales/cart-sales.component';
import { PreorderComponent } from './pages/preorder/preorder.component';
import { KpisalesComponent } from './pages/kpisales/kpisales.component';
import { AuthGuard } from '../guards/auth.guard';
import { OrdersComponent } from './pages/orders/orders.component';
import { OrderPanelComponent } from './pages/order-panel/order-panel.component';
import { ProductOrdersComponent } from './pages/product-orders/product-orders.component';
import { ListProductOrdersComponent } from './pages/list-product-orders/list-product-orders.component';
import { DashboardComponent } from './pages/dashboard/dashboard.component';
import { DashboardSellerComponent } from './pages/dashboard-seller/dashboard-seller.component';
import { DashboardCompanyComponent } from './pages/dashboard-company/dashboard-company.component';
import { ProductSaleComponent } from './pages/product-sale/product-sale.component';

const routes: Routes = [ //{
  //path: 'menu', component: DashSalesComponent /*MenuSalesComponent*/, canActivate: [AuthGuard],
/*  children: [
    { path: 'customer', component: ListCustomerComponent, canActivate: [AuthGuard]  },
    { path: 'order', component: OrderComponent, canActivate: [AuthGuard]  },
  ]},*/
{ path: 'appbar', component: SalesAppbarComponent, canActivate: [AuthGuard]  },
{
  path: 'sales', component: SalesAppbarComponent, canActivate: [AuthGuard],
  children: []
},
{
  path: 'sales/home', component: HomeSalesComponent, canActivate: [AuthGuard],
  children: []
},
{ path: 'product-detail/:id', component: ProductDetailComponent, canActivate: [AuthGuard]  },
{ path: 'sales/cart', component: CartSalesComponent, canActivate: [AuthGuard]  },
{ path: 'carrinho', component: CartComponent, canActivate: [AuthGuard]  },
{ path: 'sale-customer', component: SaleCustomerComponent, canActivate: [AuthGuard]  },
{ path: 'menu-customer', component: MenuCustomerComponent, canActivate: [AuthGuard]  },
{ path: 'order', component: OrderComponent, canActivate: [AuthGuard]  },
{ path: 'product-card', component: ProductCardComponent, canActivate: [AuthGuard]  },
{ path: 'order-panel', component: OrderPanelComponent, canActivate: [AuthGuard]  },
{ path: 'product-list', component: ProductListComponent, canActivate: [AuthGuard]  },
{ path: 'product-sale', component: ProductSaleComponent, canActivate: [AuthGuard]  },
{ path: 'product-list/:description', component: ProductListComponent, canActivate: [AuthGuard]  },
{ path: 'product-list/product-type/:type', component: ProductListComponent, canActivate: [AuthGuard]  },
{ path: 'product-list/:filter/:url', component: ProductListComponent, canActivate: [AuthGuard]  },
{
  path: 'sales/menu', component: DashSalesComponent,
  children: [
    { path: '', component: OrdersComponent, canActivate: [AuthGuard]  },
    { path: 'preorder', component: PreorderComponent, canActivate: [AuthGuard]  },
    { path: 'order', component: OrdersComponent, canActivate: [AuthGuard]  },
    { path: 'dashboard', component: DashboardComponent, canActivate: [AuthGuard]  },
    { path: 'dashboardseller', component: DashboardSellerComponent, canActivate: [AuthGuard]  },
    { path: 'product-order', component: ProductOrdersComponent, canActivate: [AuthGuard] },
    { path: 'list-product-order', component: ListProductOrdersComponent, canActivate: [AuthGuard] },
  ]
},
];

@NgModule({
  declarations: [],
  imports: [
    CommonModule,
    RouterModule.forChild(routes),
  ]
})
export class SalesRoutingModule { }
