<?php

declare(strict_types=1);

spl_autoload_register(static function (string $class_name): void {
  $prefix = 'KimaAI\\Ai\\Providers\\';

  if (strncmp($class_name, $prefix, strlen($prefix)) !== 0) {
    return;
  }

  $relative = substr($class_name, strlen($prefix));
  $file = __DIR__ . '/' . str_replace('\\', '/', $relative) . '.php';

  if (is_file($file)) {
    require_once $file;
  }
});
