import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { ModernFormsClient } from './modern_forms.classes.client.js';
import { ModernFormsConfigFlow } from './modern_forms.classes.configflow.js';
import { createModernFormsDiscoveryDescriptor } from './modern_forms.discovery.js';
import type { IModernFormsConfig } from './modern_forms.types.js';
import { modernFormsDomain, modernFormsProfile } from './modern_forms.types.js';

export class ModernFormsIntegration extends SimpleLocalIntegration<IModernFormsConfig> {
  public readonly domain = modernFormsDomain;
  public readonly discoveryDescriptor = createModernFormsDiscoveryDescriptor();
  public readonly configFlow = new ModernFormsConfigFlow();

  constructor() {
    super(modernFormsProfile);
  }

  public async setup(configArg: IModernFormsConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(modernFormsProfile, new ModernFormsClient(configArg));
  }
}

export class HomeAssistantModernFormsIntegration extends ModernFormsIntegration {}
