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

export type TPartnerAccountsRouteNames = 'accounts' | 'account';

export const partnerAccountsNamedRoutes: NamedRoutes<TPartnerAccountsRouteNames> = {
  accounts: {
    path: 'accounts',
    loadComponent: () =>
      import('../../views/list.component').then((m) => m.PartnerAccountsComponent),
    meta: {
      title: 'حساب‌های کاربری',
      pagePath: () => '/partner/accounts',
    },
  },
  account: {
    path: 'accounts/:accountId',
    loadComponent: () =>
      import('../../views/single.component').then((m) => m.PartnerAccountComponent),
    meta: {
      title: 'حساب کاربری',
      pagePath: (accountId: string) => `/partner/accounts/${accountId}`,
    },
  },
};

export const PARTNER_ACCOUNTS_ROUTES: Routes = [
  partnerAccountsNamedRoutes.accounts,
  {
    path: partnerAccountsNamedRoutes.account.path,
    loadComponent: () =>
      import('../../components/layout.component').then((m) => m.PartnerAccountLayoutComponent),
    children: [
      {
        ...partnerAccountsNamedRoutes.account,
        path: '',
      },
    ],
  },
];
