import { SessionViewModel } from '@/lib/view-models/SessionViewModel';
import { AuthApiClient } from '../../api/auth/AuthApiClient';

/**
 * Session Service
 *
 * Orchestrates session operations by coordinating API calls and view model creation.
 * All dependencies are injected via constructor.
 */
export class SessionService {
  constructor(
    private readonly apiClient: AuthApiClient
  ) {}

  /**
   * Get current user session with view model transformation
   */
  async getSession(): Promise<SessionViewModel | null> {
    const dto = await this.apiClient.getSession();
    return dto ? new SessionViewModel(dto.user) : null;
  }
}