import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { OsramlightifyClient } from './osramlightify.classes.client.js';
import { OsramlightifyConfigFlow } from './osramlightify.classes.configflow.js';
import { createOsramlightifyDiscoveryDescriptor } from './osramlightify.discovery.js';
import type { IOsramlightifyConfig } from './osramlightify.types.js';
import { osramlightifyDomain, osramlightifyProfile } from './osramlightify.types.js';

export class OsramlightifyIntegration extends SimpleLocalIntegration<IOsramlightifyConfig> {
  public readonly domain = osramlightifyDomain;
  public readonly discoveryDescriptor = createOsramlightifyDiscoveryDescriptor();
  public readonly configFlow = new OsramlightifyConfigFlow();

  constructor() {
    super(osramlightifyProfile);
  }

  public async setup(configArg: IOsramlightifyConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(osramlightifyProfile, new OsramlightifyClient(configArg));
  }
}

export class HomeAssistantOsramlightifyIntegration extends OsramlightifyIntegration {}
