import { describe, expect, it } from 'bun:test';
import type {
  ServiceContainer,
  ServiceContainerOptions,
  ServiceCradle,
  ServiceDefinitions,
} from '../src/awilix-container';

describe('Awilix Container Types', () => {
  it('should export ServiceDefinitions interface', () => {
    // Type test - if this compiles, the type exists
    const testDefinitions: Partial<ServiceDefinitions> = {
      config: {} as any,
      logger: {} as any,
      cache: null,
      proxyManager: null,
      browser: {} as any,
      queueManager: null,
      mongoClient: null,
      postgresClient: null,
      questdbClient: null,
      serviceContainer: {} as any,
    };

    expect(testDefinitions).toBeDefined();
  });

  it('should export ServiceContainer type', () => {
    // Type test - if this compiles, the type exists
    const testContainer: ServiceContainer | null = null;
    expect(testContainer).toBeNull();
  });

  it('should export ServiceCradle type', () => {
    // Type test - if this compiles, the type exists
    const testCradle: Partial<ServiceCradle> = {
      config: {} as any,
      logger: {} as any,
    };

    expect(testCradle).toBeDefined();
  });

  it('should export ServiceContainerOptions interface', () => {
    // Type test - if this compiles, the type exists
    const testOptions: ServiceContainerOptions = {
      enableQuestDB: true,
      enableMongoDB: true,
      enablePostgres: true,
      enableCache: true,
      enableQueue: true,
      enableBrowser: true,
      enableProxy: true,
    };

    expect(testOptions).toBeDefined();
    expect(testOptions.enableQuestDB).toBe(true);
    expect(testOptions.enableMongoDB).toBe(true);
    expect(testOptions.enablePostgres).toBe(true);
    expect(testOptions.enableCache).toBe(true);
    expect(testOptions.enableQueue).toBe(true);
    expect(testOptions.enableBrowser).toBe(true);
    expect(testOptions.enableProxy).toBe(true);
  });

  it('should allow partial ServiceContainerOptions', () => {
    const partialOptions: ServiceContainerOptions = {
      enableCache: true,
      enableQueue: false,
    };

    expect(partialOptions.enableCache).toBe(true);
    expect(partialOptions.enableQueue).toBe(false);
    expect(partialOptions.enableQuestDB).toBeUndefined();
  });
});
