import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { FolderWatcherClient } from './folder_watcher.classes.client.js';
import { FolderWatcherConfigFlow } from './folder_watcher.classes.configflow.js';
import { createFolderWatcherDiscoveryDescriptor } from './folder_watcher.discovery.js';
import type { IFolderWatcherConfig } from './folder_watcher.types.js';
import { folderWatcherDomain, folderWatcherProfile } from './folder_watcher.types.js';

export class FolderWatcherIntegration extends SimpleLocalIntegration<IFolderWatcherConfig> {
  public readonly domain = folderWatcherDomain;
  public readonly discoveryDescriptor = createFolderWatcherDiscoveryDescriptor();
  public readonly configFlow = new FolderWatcherConfigFlow();

  constructor() {
    super(folderWatcherProfile);
  }

  public async setup(configArg: IFolderWatcherConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(folderWatcherProfile, new FolderWatcherClient(configArg));
  }
}

export class HomeAssistantFolderWatcherIntegration extends FolderWatcherIntegration {}
