import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { MochadClient } from './mochad.classes.client.js';
import { MochadConfigFlow } from './mochad.classes.configflow.js';
import { createMochadDiscoveryDescriptor } from './mochad.discovery.js';
import type { IMochadConfig } from './mochad.types.js';
import { mochadDomain, mochadProfile } from './mochad.types.js';

export class MochadIntegration extends SimpleLocalIntegration<IMochadConfig> {
  public readonly domain = mochadDomain;
  public readonly discoveryDescriptor = createMochadDiscoveryDescriptor();
  public readonly configFlow = new MochadConfigFlow();

  constructor() {
    super(mochadProfile);
  }

  public async setup(configArg: IMochadConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(mochadProfile, new MochadClient(configArg));
  }
}

export class HomeAssistantMochadIntegration extends MochadIntegration {}
