import { InjectionToken, inject } from '@angular/core';
import { RuntimeProviderStrategyService } from '../../../../core/providers/runtime-provider-strategy.service';
import { AdminCategoriesApiGateway } from './admin-categories-api.gateway';
import { AdminCategoriesLocalGateway } from './admin-categories-local.gateway';
import { AdminCategoriesGateway } from './admin-categories-gateway.interface';

export const ADMIN_CATEGORIES_GATEWAY = new InjectionToken<AdminCategoriesGateway>('ADMIN_CATEGORIES_GATEWAY', {
  providedIn: 'root',
  factory: () => {
    const strategy = inject(RuntimeProviderStrategyService);
    const mode = strategy.getCategoryProviderMode();
    return mode === 'mock' ? inject(AdminCategoriesLocalGateway) : inject(AdminCategoriesApiGateway);
  }
});
