import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { LocalFileClient } from './local_file.classes.client.js';
import { LocalFileConfigFlow } from './local_file.classes.configflow.js';
import { createLocalFileDiscoveryDescriptor } from './local_file.discovery.js';
import type { ILocalFileConfig } from './local_file.types.js';
import { localFileDomain, localFileProfile } from './local_file.types.js';

export class LocalFileIntegration extends SimpleLocalIntegration<ILocalFileConfig> {
  public readonly domain = localFileDomain;
  public readonly discoveryDescriptor = createLocalFileDiscoveryDescriptor();
  public readonly configFlow = new LocalFileConfigFlow();

  constructor() {
    super(localFileProfile);
  }

  public async setup(configArg: ILocalFileConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(localFileProfile, new LocalFileClient(configArg));
  }
}
