import { APP_INITIALIZER, ApplicationConfig, inject } from '@angular/core';
import { provideHttpClient } from '@angular/common/http';
import { provideNoopAnimations } from '@angular/platform-browser/animations';
import { provideRouter } from '@angular/router';

import { routes } from './app.routes';
import { CashlineApiService } from './core/cashline-api.service';

export const appConfig: ApplicationConfig = {
  providers: [
    provideNoopAnimations(),
    provideHttpClient(),
    provideRouter(routes),
    {
      provide: APP_INITIALIZER,
      multi: true,
      useFactory: () => {
        const api = inject(CashlineApiService);
        return () => api.initialize();
      }
    }
  ]
};
