import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { LupusecClient } from './lupusec.classes.client.js';
import { LupusecConfigFlow } from './lupusec.classes.configflow.js';
import { createLupusecDiscoveryDescriptor } from './lupusec.discovery.js';
import type { ILupusecConfig } from './lupusec.types.js';
import { lupusecDomain, lupusecProfile } from './lupusec.types.js';

export class LupusecIntegration extends SimpleLocalIntegration<ILupusecConfig> {
  public readonly domain = lupusecDomain;
  public readonly discoveryDescriptor = createLupusecDiscoveryDescriptor();
  public readonly configFlow = new LupusecConfigFlow();

  constructor() {
    super(lupusecProfile);
  }

  public async setup(configArg: ILupusecConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(lupusecProfile, new LupusecClient(configArg));
  }
}

export class HomeAssistantLupusecIntegration extends LupusecIntegration {}
