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

export const goalzeroDomain = 'goalzero';
export const goalzeroDefaultName = 'Yeti';

export type TGoalzeroRawData = TSimpleLocalRawData;
export interface IGoalzeroSnapshot extends ISimpleLocalSnapshot {}
export interface IGoalzeroConfig extends ISimpleLocalConfig {}
export interface IHomeAssistantGoalzeroConfig extends IGoalzeroConfig {}

export const goalzeroProfile: ISimpleLocalIntegrationProfile = {
  domain: 'goalzero',
  displayName: 'Goal Zero Yeti',
  manufacturer: 'Goal Zero',
  model: 'Yeti',
  defaultName: goalzeroDefaultName,
  defaultProtocol: 'http',
  status: 'read-only-runtime',
  platforms: [
    'binary_sensor',
    'sensor',
    'switch',
  ],
  serviceDomains: [
    'binary_sensor',
    'sensor',
    'switch',
  ],
  controlServices: [
    'turn_on',
    'turn_off',
  ],
  discoverySources: [
    'manual',
    'dhcp',
    'http',
    'custom',
  ],
  discoveryKeywords: [
    'goal zero',
    'goalzero',
    'yeti',
    'battery',
    'power station',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/goalzero',
    upstreamDomain: 'goalzero',
    integrationType: 'device',
    iotClass: 'local_polling',
    qualityScale: undefined,
    requirements: [
      'goalzero==0.2.2',
    ],
    dependencies: [],
    afterDependencies: [],
    codeowners: [
      '@tkdrob',
    ],
    configFlow: true,
    documentation: 'https://www.home-assistant.io/integrations/goalzero',
    dhcp: [
      { registered_devices: true },
      { hostname: 'yeti*' },
    ],
    loggers: [
      'goalzero',
    ],
    homeAssistantPlatforms: [
      'binary_sensor',
      'sensor',
      'switch',
    ],
    defaults: {
      updateIntervalSeconds: 30,
      defaultName: goalzeroDefaultName,
    },
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
        'turn_on',
        'turn_off',
      ],
      platforms: [
        'binary_sensor',
        'sensor',
        'switch',
      ],
      controls: 'delegated only to an injected client.execute or commandExecutor',
    },
    localApi: {
      implemented: [
        'manual local host setup and DHCP candidate matching',
        'runtime mapping for Goal Zero Yeti sysdata and state snapshots',
        'safe switch control delegation to injected client.execute or commandExecutor only',
      ],
      explicitUnsupported: [
        'direct goalzero Python client calls from this TypeScript package',
        'claiming Yeti switch write success without an injected client.execute or commandExecutor',
        'device-specific HTTP endpoints not represented by snapshot/rawData/client/executor inputs',
      ],
    },
  },
};
