import { SimpleLocalIntegration, SimpleLocalRuntime, type IIntegrationRuntime, type IIntegrationSetupContext } from '../../core/index.js';
import { MobileAppClient } from './mobile_app.classes.client.js';
import { MobileAppConfigFlow } from './mobile_app.classes.configflow.js';
import { createMobileAppDiscoveryDescriptor } from './mobile_app.discovery.js';
import type { IMobileAppConfig } from './mobile_app.types.js';
import { mobileAppDomain, mobileAppProfile } from './mobile_app.types.js';

export class MobileAppIntegration extends SimpleLocalIntegration<IMobileAppConfig> {
  public readonly domain = mobileAppDomain;
  public readonly discoveryDescriptor = createMobileAppDiscoveryDescriptor();
  public readonly configFlow = new MobileAppConfigFlow();

  constructor() {
    super(mobileAppProfile);
  }

  public async setup(configArg: IMobileAppConfig, contextArg: IIntegrationSetupContext): Promise<IIntegrationRuntime> {
    void contextArg;
    return new SimpleLocalRuntime(mobileAppProfile, new MobileAppClient(configArg));
  }
}

export class HomeAssistantMobileAppIntegration extends MobileAppIntegration {}
