import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { MutesyncClient } from './mutesync.classes.client.js';
import { MutesyncConfigFlow } from './mutesync.classes.configflow.js';
import { createMutesyncDiscoveryDescriptor } from './mutesync.discovery.js';
import type { IMutesyncConfig } from './mutesync.types.js';
import { mutesyncDomain, mutesyncProfile } from './mutesync.types.js';

export class MutesyncIntegration extends SimpleLocalIntegration<IMutesyncConfig> {
  public readonly domain = mutesyncDomain;
  public readonly discoveryDescriptor = createMutesyncDiscoveryDescriptor();
  public readonly configFlow = new MutesyncConfigFlow();

  constructor() {
    super(mutesyncProfile);
  }

  public async setup(configArg: IMutesyncConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(mutesyncProfile, new MutesyncClient(configArg));
  }
}

export class HomeAssistantMutesyncIntegration extends MutesyncIntegration {}
