import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { OllamaClient } from './ollama.classes.client.js';
import { OllamaConfigFlow } from './ollama.classes.configflow.js';
import { createOllamaDiscoveryDescriptor } from './ollama.discovery.js';
import type { IOllamaConfig } from './ollama.types.js';
import { ollamaDomain, ollamaProfile } from './ollama.types.js';

export class OllamaIntegration extends SimpleLocalIntegration<IOllamaConfig> {
  public readonly domain = ollamaDomain;
  public readonly discoveryDescriptor = createOllamaDiscoveryDescriptor();
  public readonly configFlow = new OllamaConfigFlow();

  constructor() {
    super(ollamaProfile);
  }

  public async setup(configArg: IOllamaConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(ollamaProfile, new OllamaClient(configArg));
  }
}

export class HomeAssistantOllamaIntegration extends OllamaIntegration {}
