import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { HomeeClient } from './homee.classes.client.js';
import { HomeeConfigFlow } from './homee.classes.configflow.js';
import { createHomeeDiscoveryDescriptor } from './homee.discovery.js';
import type { IHomeeConfig } from './homee.types.js';
import { homeeDomain, homeeProfile } from './homee.types.js';

export class HomeeIntegration extends SimpleLocalIntegration<IHomeeConfig> {
  public readonly domain = homeeDomain;
  public readonly discoveryDescriptor = createHomeeDiscoveryDescriptor();
  public readonly configFlow = new HomeeConfigFlow();

  constructor() {
    super(homeeProfile);
  }

  public async setup(configArg: IHomeeConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(homeeProfile, new HomeeClient(configArg));
  }
}

export class HomeAssistantHomeeIntegration extends HomeeIntegration {}
