const test = require('node:test');
const assert = require('node:assert/strict');

const barrel = require('../index.js');

test('barrel exports expected public members', () => {
  const expected = [
    'predict',
    'interpolation',
    'configManager',
    'assetApiConfig',
    'outputUtils',
    'configUtils',
    'logger',
    'validation',
    'assertions',
    'MeasurementContainer',
    'nrmse',
    'state',
    'coolprop',
    'convert',
    'MenuManager',
    'PIDController',
    'CascadePIDController',
    'createPidController',
    'createCascadePidController',
    'childRegistrationUtils',
    'loadCurve',
    'gravity',
    'AssetResolver',
    'FileBackend',
    'HttpBackend',
    'assetResolver',
  ];

  for (const key of expected) {
    assert.ok(key in barrel, `missing export: ${key}`);
  }
});

test('barrel types are callable where expected', () => {
  assert.equal(typeof barrel.logger, 'function');
  assert.equal(typeof barrel.validation, 'function');
  assert.equal(typeof barrel.configUtils, 'function');
  assert.equal(typeof barrel.outputUtils, 'function');
  assert.equal(typeof barrel.MeasurementContainer, 'function');
  assert.equal(typeof barrel.convert, 'function');
  assert.equal(typeof barrel.PIDController, 'function');
  assert.equal(typeof barrel.CascadePIDController, 'function');
  assert.equal(typeof barrel.createPidController, 'function');
  assert.equal(typeof barrel.createCascadePidController, 'function');
  assert.equal(typeof barrel.gravity.getStandardGravity, 'function');
  assert.equal(typeof barrel.AssetResolver, 'function');
  assert.equal(typeof barrel.FileBackend, 'function');
  assert.equal(typeof barrel.HttpBackend, 'function');
  assert.equal(typeof barrel.assetResolver.resolve, 'function');
});
