import type { ISimpleLocalConfig, ISimpleLocalIntegrationProfile, ISimpleLocalSnapshot, TSimpleLocalRawData } from '../../core/index.js';

export const googleWifiDomain = 'google_wifi';
export const googleWifiDefaultName = 'google_wifi';
export const googleWifiDefaultHost = 'testwifi.here';
export const googleWifiStatusPath = '/api/v1/status';

export type TGoogleWifiRawData = TSimpleLocalRawData;
export interface IGoogleWifiSnapshot extends ISimpleLocalSnapshot {}
export interface IGoogleWifiConfig extends ISimpleLocalConfig {
  monitoredConditions?: string[];
  monitored_conditions?: string[];
}
export interface IHomeAssistantGoogleWifiConfig extends IGoogleWifiConfig {}

export const googleWifiProfile: ISimpleLocalIntegrationProfile = {
  domain: 'google_wifi',
  displayName: 'Google Wifi',
  manufacturer: 'Google',
  model: 'Wifi/OnHub router',
  defaultName: googleWifiDefaultName,
  defaultHttpPath: googleWifiStatusPath,
  defaultProtocol: 'http',
  status: 'read-only-runtime',
  platforms: [
    'sensor',
  ],
  serviceDomains: [
    'sensor',
  ],
  controlServices: [
    'turn_on',
    'turn_off',
  ],
  discoverySources: [
    'manual',
    'http',
    'custom',
  ],
  discoveryKeywords: [
    'google wifi',
    'google_wifi',
    'onhub',
    'testwifi.here',
    'router',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/google_wifi',
    upstreamDomain: 'google_wifi',
    iotClass: 'local_polling',
    qualityScale: 'legacy',
    requirements: [],
    dependencies: [],
    afterDependencies: [],
    codeowners: [],
    configFlow: false,
    documentation: 'https://www.home-assistant.io/integrations/google_wifi',
    homeAssistantPlatforms: [
      'sensor',
    ],
    defaults: {
      host: googleWifiDefaultHost,
      endpoint: googleWifiStatusPath,
      monitoredConditions: [
        'current_version',
        'new_version',
        'uptime',
        'last_restart',
        'local_ip',
        'status',
      ],
      minTimeBetweenUpdatesSeconds: 1,
    },
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
      ],
      platforms: [
        'sensor',
      ],
      controls: 'delegated only to an injected client.execute or commandExecutor',
    },
    localApi: {
      implemented: [
        'manual local setup for Google Wifi status endpoint snapshots',
        'HTTP status reads from /api/v1/status when host/path are supplied',
        'runtime mapping for Google Wifi software, system, and WAN status data',
      ],
      explicitUnsupported: [
        'router configuration writes or restarts from this TypeScript package',
        'claiming command success without an injected client.execute or commandExecutor',
        'YAML-only Home Assistant platform setup beyond local snapshot/runtime representation',
      ],
    },
  },
};
