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

export type TBusinessActivitiesRouteNames = 'businessActivities' | 'businessActivity';

export const superAdminConsumerBusinessActivitiesNamedRoutes: NamedRoutes<TBusinessActivitiesRouteNames> =
  {
    businessActivities: {
      path: 'business_activities',
      loadComponent: () =>
        import('../../views/businessActivities/list.component').then(
          (m) => m.SuperAdminUserBusinessActivitiesComponent,
        ),
      // @ts-ignore
      meta: {
        title: 'فعالیت اقتصادی',
        pagePath: (consumerId: string) =>
          `/super_admin/consumers/${consumerId}/business_activities`,
      },
    },
    businessActivity: {
      path: 'business_activities/:businessActivityId',
      loadComponent: () =>
        import('../../views/businessActivities/single.component').then(
          (m) => m.SuperAdminUserBusinessActivityComponent,
        ),
      // @ts-ignore
      meta: {
        title: 'فعالیت اقتصادی',
        pagePath: (consumerId: string, businessId: string) =>
          `/super_admin/consumers/${consumerId}/business_activities/${businessId}`,
      },
    },
  };

export const SUPER_ADMIN_CONSUMER_BUSINESS_ACTIVITIES_ROUTES: Routes = [
  superAdminConsumerBusinessActivitiesNamedRoutes.businessActivities,
  {
    path: superAdminConsumerBusinessActivitiesNamedRoutes.businessActivity.path,
    loadComponent: () =>
      import('../../components/businessActivities/layout.component').then(
        (m) => m.SuperAdminUserBusinessActivityLayoutComponent,
      ),
    children: [
      {
        path: '',
        loadComponent:
          superAdminConsumerBusinessActivitiesNamedRoutes.businessActivity.loadComponent,
      },
      ...SUPER_ADMIN_CONSUMER_COMPLEXES_ROUTES,
    ],
  },
];
