import { inject, Injectable } from '@angular/core';
import { AvailabilityService } from '../services';
import {
  GetAvailabilityInputParams,
  GetSingleItemAvailabilityInputParams,
} from '../schemas';

// TODO: [Architecture Simplification - Medium Priority] Evaluate facade necessity
// Current: Pass-through wrapper with no added value (delegates directly to service)
// Recommendation: Consider removal if no orchestration/composition is needed
//
// Analysis:
//   - Facade pattern is valuable when:
//     ✓ Orchestrating multiple services
//     ✓ Adding cross-cutting concerns (caching, analytics)
//     ✓ Providing simplified API for complex subsystem
//
//   - This facade currently:
//     ✗ Just delegates to AvailabilityService
//     ✗ No orchestration logic
//     ✗ No added value over direct service injection
//
// Proposed action:
//   1. If no future orchestration planned:
//      - Remove this facade
//      - Update components to inject AvailabilityService directly
//      - Remove from index.ts exports
//
//   2. If orchestration is planned:
//      - Keep facade but add clear documentation
//      - Document future intentions (what will be orchestrated)
//
// Benefits (if removed):
//   - One less layer of indirection
//   - Clearer code path (component → service)
//   - Less maintenance burden
//   - Facade pattern only where it adds value
//
// Effort: ~1 hour | Impact: Low | Risk: Very Low
// See: complexity-analysis.md (Architecture Section, Issue 2)
@Injectable({ providedIn: 'root' })
export class AvailabilityFacade {
  #availabilityService = inject(AvailabilityService);

  getAvailabilities(
    params: GetAvailabilityInputParams,
    abortSignal?: AbortSignal,
  ) {
    return this.#availabilityService.getAvailabilities(params, abortSignal);
  }

  getAvailability(
    params: GetSingleItemAvailabilityInputParams,
    abortSignal?: AbortSignal,
  ) {
    return this.#availabilityService.getAvailability(params, abortSignal);
  }
}
