import { NamedRoutes } from '@/core';
import { Routes } from '@angular/router';
import { SUPER_ADMIN_CONSUMER_ACCOUNTS_ROUTES } from './accounts';
import { SUPER_ADMIN_CONSUMER_BUSINESS_ACTIVITIES_ROUTES } from './businessActivities';

export type TConsumersRouteNames = 'consumers' | 'consumer';

export const superAdminConsumersNamedRoutes: NamedRoutes<TConsumersRouteNames> = {
  consumers: {
    path: 'consumers',
    loadComponent: () => import('../../views/list.component').then((m) => m.ConsumersComponent),
    meta: {
      title: 'مشتری‌ها',
      pagePath: () => '/super_admin/consumers',
    },
  },
  consumer: {
    path: 'consumers/:consumerId',
    loadComponent: () => import('../../views/single.component').then((m) => m.ConsumerComponent),
    meta: {
      title: 'مشتری',
      pagePath: (guildId: string) => `/super_admin/consumers/${guildId}`,
    },
  },
};

export const CONSUMERS_ROUTES: Routes = [
  superAdminConsumersNamedRoutes.consumers,
  {
    path: 'consumers/:consumerId',
    loadComponent: () =>
      import('../../components/layout.component').then((m) => m.ConsumerLayoutComponent),

    children: [
      {
        path: '',
        loadComponent: () =>
          import('../../views/single.component').then((m) => m.ConsumerComponent),
      },
      ...SUPER_ADMIN_CONSUMER_ACCOUNTS_ROUTES,
      ...SUPER_ADMIN_CONSUMER_BUSINESS_ACTIVITIES_ROUTES,
    ],
  },
];
