import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { IzoneClient } from './izone.classes.client.js';
import { IzoneConfigFlow } from './izone.classes.configflow.js';
import { createIzoneDiscoveryDescriptor } from './izone.discovery.js';
import type { IIzoneConfig } from './izone.types.js';
import { izoneDomain, izoneProfile } from './izone.types.js';

export class IzoneIntegration extends SimpleLocalIntegration<IIzoneConfig> {
  public readonly domain = izoneDomain;
  public readonly discoveryDescriptor = createIzoneDiscoveryDescriptor();
  public readonly configFlow = new IzoneConfigFlow();

  constructor() {
    super(izoneProfile);
  }

  public async setup(configArg: IIzoneConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(izoneProfile, new IzoneClient(configArg));
  }
}

export class HomeAssistantIzoneIntegration extends IzoneIntegration {}
