import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { FileClient } from './file.classes.client.js';
import { FileConfigFlow } from './file.classes.configflow.js';
import { createFileDiscoveryDescriptor } from './file.discovery.js';
import type { IFileConfig } from './file.types.js';
import { fileDomain, fileProfile } from './file.types.js';

export class FileIntegration extends SimpleLocalIntegration<IFileConfig> {
  public readonly domain = fileDomain;
  public readonly discoveryDescriptor = createFileDiscoveryDescriptor();
  public readonly configFlow = new FileConfigFlow();

  constructor() {
    super(fileProfile);
  }

  public async setup(configArg: IFileConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(fileProfile, new FileClient(configArg));
  }
}

export class HomeAssistantFileIntegration extends FileIntegration {}
