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

export type TConsumerCustomerSaleInvoicesRouteNames = 'saleInvoices' | 'saleInvoice';

export const consumerCustomerSaleInvoicesNamedRoutes: NamedRoutes<TConsumerCustomerSaleInvoicesRouteNames> =
  {
    saleInvoices: {
      path: 'saleInvoices',
      loadComponent: () =>
        import('../../views/saleInvoices/list.component').then(
          (m) => m.ConsumerCustomerSaleInvoicesComponent,
        ),
      meta: {
        title: 'فاکتورهای صادر شده',
        pagePath: (customerId: string) => `consumer/customers/${customerId}`,
      },
    },
    saleInvoice: {
      path: 'saleInvoices/:invoiceId',
      loadComponent: () =>
        import('../../views/saleInvoices/single.component').then(
          (m) => m.ConsumerCustomerSaleInvoiceComponent,
        ),
      meta: {
        title: 'فاکتور صادر شده',
        pagePath: (customerId: string, saleInvoiceId: string) =>
          `consumer/customers/${customerId}/saleInvoices/${saleInvoiceId}`,
      },
    },
  };

export const CONSUMER_CUSTOMER_SALE_INVOICES_ROUTES: Routes = [
  consumerCustomerSaleInvoicesNamedRoutes.saleInvoices,
  consumerCustomerSaleInvoicesNamedRoutes.saleInvoice,
];
