import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { Gogogate2Client } from './gogogate2.classes.client.js';
import { Gogogate2ConfigFlow } from './gogogate2.classes.configflow.js';
import { createGogogate2DiscoveryDescriptor } from './gogogate2.discovery.js';
import type { IGogogate2Config } from './gogogate2.types.js';
import { gogogate2Domain, gogogate2Profile } from './gogogate2.types.js';

export class Gogogate2Integration extends SimpleLocalIntegration<IGogogate2Config> {
  public readonly domain = gogogate2Domain;
  public readonly discoveryDescriptor = createGogogate2DiscoveryDescriptor();
  public readonly configFlow = new Gogogate2ConfigFlow();

  constructor() {
    super(gogogate2Profile);
  }

  public async setup(configArg: IGogogate2Config, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(gogogate2Profile, new Gogogate2Client(configArg));
  }
}

export class HomeAssistantGogogate2Integration extends Gogogate2Integration {}
