import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { MystromClient } from './mystrom.classes.client.js';
import { MystromConfigFlow } from './mystrom.classes.configflow.js';
import { createMystromDiscoveryDescriptor } from './mystrom.discovery.js';
import type { IMystromConfig } from './mystrom.types.js';
import { mystromDomain, mystromProfile } from './mystrom.types.js';

export class MystromIntegration extends SimpleLocalIntegration<IMystromConfig> {
  public readonly domain = mystromDomain;
  public readonly discoveryDescriptor = createMystromDiscoveryDescriptor();
  public readonly configFlow = new MystromConfigFlow();

  constructor() {
    super(mystromProfile);
  }

  public async setup(configArg: IMystromConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(mystromProfile, new MystromClient(configArg));
  }
}

export class HomeAssistantMystromIntegration extends MystromIntegration {}
