/**
 * @ai-summary User export service
 * @ai-context Coordinates user data export operations
 */

import { Pool } from 'pg';
import pool from '../../../core/config/database';
import { VehiclesRepository } from '../../vehicles/data/vehicles.repository';
import { FuelLogsRepository } from '../../fuel-logs/data/fuel-logs.repository';
import { DocumentsRepository } from '../../documents/data/documents.repository';
import { MaintenanceRepository } from '../../maintenance/data/maintenance.repository';
import { UserExportArchiveService } from './user-export-archive.service';
import { UserExportResult } from './user-export.types';

export class UserExportService {
  private archiveService: UserExportArchiveService;

  constructor(db: Pool = pool) {
    this.archiveService = new UserExportArchiveService(
      new VehiclesRepository(db),
      new FuelLogsRepository(db),
      new DocumentsRepository(db),
      new MaintenanceRepository(db)
    );
  }

  async exportUserData(userId: string): Promise<UserExportResult> {
    return this.archiveService.createUserExport(userId);
  }
}
