import { NgModule } from '@angular/core';
import { RouterModule, Routes } from '@angular/router';
import { AuthGuard } from '@shared/auth/auth.guard';
import { AddCreditComponent } from './add-credit/add-credit.component';
import { IRouteConfig } from '@shared/ui-api/interfaces/route-config/route-config';
import { ClientResolver } from '@fleio-api/client-user/client/client.resolver';

const routes: Routes = [
  {
    path: '',
    component: AddCreditComponent,
    canActivate: [AuthGuard],
    data: {
      config: {
        feature: 'billing.addcredit'
      }
    }
  },
  {
    path: ':id',
    component: AddCreditComponent,
    canActivate: [AuthGuard],
    resolve: {
      client: ClientResolver,
    },
    data: {
      config: {
        getBreadCrumbDetail: (data) => $localize`Add credit for ${data.client.name}`,
      } as IRouteConfig,
    },
  },
];

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