import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { GreeClient } from './gree.classes.client.js';
import { GreeConfigFlow } from './gree.classes.configflow.js';
import { createGreeDiscoveryDescriptor } from './gree.discovery.js';
import type { IGreeConfig } from './gree.types.js';
import { greeDomain, greeProfile } from './gree.types.js';

export class GreeIntegration extends SimpleLocalIntegration<IGreeConfig> {
  public readonly domain = greeDomain;
  public readonly discoveryDescriptor = createGreeDiscoveryDescriptor();
  public readonly configFlow = new GreeConfigFlow();

  constructor() {
    super(greeProfile);
  }

  public async setup(configArg: IGreeConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(greeProfile, new GreeClient(configArg));
  }
}

export class HomeAssistantGreeIntegration extends GreeIntegration {}
