import { NamedRoutes } from '@/core';
import { Routes } from '@angular/router';

export type TPartnerCustomersRouteNames = 'customers' | 'customer';

export const partnerCustomersNamedRoutes: NamedRoutes<TPartnerCustomersRouteNames> = {
  customers: {
    path: 'customers',
    loadComponent: () =>
      import('../../views/list.component').then((m) => m.PartnerCustomersComponent),
    meta: {
      title: 'مشتری‌ها',
      pagePath: () => 'partner/customers',
    },
  },
  customer: {
    path: 'customers/:customerId',
    loadComponent: () =>
      import('../../views/single.component').then((m) => m.PartnerCustomerComponent),
    meta: {
      title: 'مشتری',
      pagePath: (customerId: string) => `partner/customers/${customerId}`,
    },
  },
};

export const PARTNER_CUSTOMERS_ROUTES: Routes = [
  partnerCustomersNamedRoutes.customers,
  {
    path: partnerCustomersNamedRoutes.customer.path,
    loadComponent: () =>
      import('../../components/layout.component').then((m) => m.PartnerCustomerLayoutComponent),
    children: [
      {
        ...partnerCustomersNamedRoutes.customer,
        path: '',
      },
    ],
  },
];
