import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { FolderClient } from './folder.classes.client.js';
import { FolderConfigFlow } from './folder.classes.configflow.js';
import { createFolderDiscoveryDescriptor } from './folder.discovery.js';
import type { IFolderConfig } from './folder.types.js';
import { folderDomain, folderProfile } from './folder.types.js';

export class FolderIntegration extends SimpleLocalIntegration<IFolderConfig> {
  public readonly domain = folderDomain;
  public readonly discoveryDescriptor = createFolderDiscoveryDescriptor();
  public readonly configFlow = new FolderConfigFlow();

  constructor() {
    super(folderProfile);
  }

  public async setup(configArg: IFolderConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(folderProfile, new FolderClient(configArg));
  }
}

export class HomeAssistantFolderIntegration extends FolderIntegration {}
