// IRU End-to-End Integration Tests

import { marketplaceService } from '@/core/iru/marketplace.service';
import { qualificationEngine } from '@/core/iru/qualification/qualification-engine.service';
import { agreementGenerator } from '@/core/iru/agreement/agreement-generator.service';
import { iruProvisioningService } from '@/core/iru/provisioning/iru-provisioning.service';
import { deploymentOrchestrator } from '@/core/iru/deployment/deployment-orchestrator.service';

describe('IRU End-to-End Flow', () => {
  it('should complete full IRU subscription and deployment flow', async () => {
    // Step 1: Submit inquiry
    const inquiry = await marketplaceService.submitInquiry({
      offeringId: 'IRU-OFF-001',
      organizationName: 'Test Central Bank',
      institutionalType: 'CentralBank',
      jurisdiction: 'US',
      contactEmail: 'test@centralbank.gov',
      contactName: 'Test User',
      estimatedVolume: '10M',
    });

    expect(inquiry.inquiryId).toBeDefined();
    expect(inquiry.status).toBe('submitted');

    // Step 2: Process qualification
    const qualification = await qualificationEngine.processQualification({
      inquiryId: inquiry.inquiryId,
      preliminaryInfo: {
        registrationNumber: 'REG-123',
        regulatoryBody: 'Federal Reserve',
      },
    });

    expect(qualification.qualified).toBe(true);

    // Step 3: Generate agreement (would require subscription creation first)
    // This is a simplified test - in production, subscription would be created after qualification

    // Step 4: Provision IRU
    // const provisioning = await iruProvisioningService.provision({
    //   subscriptionId: 'SUB-123',
    // });

    // Step 5: Deploy infrastructure
    // const deployment = await deploymentOrchestrator.initiateDeployment({
    //   subscriptionId: 'SUB-123',
    // });

    // expect(deployment.deploymentId).toBeDefined();
    // expect(deployment.status).toBe('provisioning');
  });
});
