import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { IRouteConfig } from '@shared/ui-api/interfaces/route-config/route-config';
import { AuthGuard } from '@shared/auth/auth.guard';
import { ReportsListComponent } from './reports-list/reports-list.component';
import { EstimatedInstanceRevenueComponent } from './estimated-instance-revenue/estimated-instance-revenue.component';
import { YearlyRevenueComponent } from './yearly-revenue/yearly-revenue.component';

const routes: Routes = [
  {
    path: '',
    component: ReportsListComponent,
    resolve: {
    },
    canActivate: [AuthGuard],
    data: {
      config: {
        feature: 'utils.reports',
        search: {
          show: false,
        },
        subheader: {
          objectList: (data) => null,
          objectName: $localize`report`,
          objectNamePlural: $localize`reports`,
        },
        getBreadCrumbDetail: () => $localize`Reports`,
      } as IRouteConfig,
    },
    runGuardsAndResolvers: 'always'
  },
  {
    path: 'revenue-reports',
    loadChildren: () => import('./revenue-reports/revenue-reports.module').then(mod => mod.RevenueReportsModule),
  },
  {
    path: 'estimated-instance-revenue',
    component: EstimatedInstanceRevenueComponent,
    resolve: {
    },
    canActivate: [AuthGuard],
    data: {
      config: {
        feature: 'utils.reports.estimated_instance_monthly_revenue',
        search: {
          show: false,
        },
        subheader: {
          objectList: () => null,
          objectName: $localize`report`,
          objectNamePlural: $localize`reports`,
        },
        getBreadCrumbDetail: () => $localize`Estimated instance monthly revenue report`,
      } as IRouteConfig,
    },
    runGuardsAndResolvers: 'always'
  },
  {
    path: 'yearly-revenue',
    component: YearlyRevenueComponent,
    resolve: {
    },
    canActivate: [AuthGuard],
    data: {
      config: {
        feature: 'utils.reports.yearly_revenue',
        search: {
          show: false,
        },
        subheader: {
          objectList: () => null,
          objectName: $localize`report`,
          objectNamePlural: $localize`reports`,
        },
        getBreadCrumbDetail: () => $localize`Yearly revenue report`,
      } as IRouteConfig,
    },
    runGuardsAndResolvers: 'always'
  },
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule],
})
export class ReportsRoutingModule {
}
