import { HttpClient } from '@angular/common/http';
import { Injectable, inject } from '@angular/core';
import { Observable } from 'rxjs';
import { AdminDashboardMetrics } from '../models/admin-dashboard.model';
import { AdminDashboardMetricsGateway } from './admin-dashboard-metrics.gateway.interface';

/**
 * No dedicated dashboard-metrics contract doc exists yet. Phase 9 §7 lists
 * the target metrics (GMV, paid orders, conversion, etc.) without a wire
 * shape - at the conventional /api/admin/v2/{resource} path pending that.
 */
@Injectable({ providedIn: 'root' })
export class AdminDashboardMetricsApiGateway implements AdminDashboardMetricsGateway {
  private readonly http = inject(HttpClient);

  loadMetrics(): Observable<AdminDashboardMetrics> {
    return this.http.get<AdminDashboardMetrics>('/api/admin/v2/dashboard/metrics');
  }
}
