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

export const homeeDomain = 'homee';
export const homeeDefaultName = 'Homee';

export type THomeeRawData = TSimpleLocalRawData;
export interface IHomeeSnapshot extends ISimpleLocalSnapshot {}
export interface IHomeeConfig extends ISimpleLocalConfig {
  homeeName?: string;
}
export interface IHomeAssistantHomeeConfig extends IHomeeConfig {}

export const homeeProfile: ISimpleLocalIntegrationProfile = {
  domain: 'homee',
  displayName: 'Homee',
  manufacturer: 'homee',
  model: 'homee',
  defaultName: homeeDefaultName,
  defaultProtocol: 'websocket',
  status: 'read-only-runtime',
  platforms: [
    'binary_sensor',
    'button',
    'climate',
    'cover',
    'fan',
    'light',
    'number',
    'select',
    'sensor',
    'switch',
  ],
  serviceDomains: [
    'alarm_control_panel',
    'button',
    'climate',
    'cover',
    'fan',
    'light',
    'lock',
    'number',
    'select',
    'siren',
    'switch',
    'valve',
  ],
  controlServices: [
    'alarm_arm_away',
    'alarm_arm_home',
    'alarm_disarm',
    'close_cover',
    'lock',
    'open_cover',
    'press',
    'select_option',
    'set_hvac_mode',
    'set_percentage',
    'set_position',
    'set_preset_mode',
    'set_temperature',
    'set_value',
    'stop_cover',
    'toggle',
    'turn_off',
    'turn_on',
    'unlock',
  ],
  discoverySources: [
    'manual',
    'mdns',
    'custom',
  ],
  discoveryKeywords: [
    'homee',
    '_ssh._tcp.local',
    'homee-',
    'cube',
    'smart home hub',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/homee',
    upstreamDomain: 'homee',
    integrationType: 'hub',
    iotClass: 'local_push',
    qualityScale: 'silver',
    requirements: [
      'pyHomee==1.3.8',
    ],
    dependencies: [],
    afterDependencies: [],
    codeowners: [
      '@Taraman17',
    ],
    configFlow: true,
    documentation: 'https://www.home-assistant.io/integrations/homee',
    zeroconf: [
      {
        name: 'homee-*',
        type: '_ssh._tcp.local.',
      },
    ],
    platforms: [
      'alarm_control_panel',
      'binary_sensor',
      'button',
      'climate',
      'cover',
      'event',
      'fan',
      'light',
      'lock',
      'number',
      'select',
      'sensor',
      'siren',
      'switch',
      'valve',
    ],
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
        'alarm_arm_away',
        'alarm_arm_home',
        'alarm_disarm',
        'close_cover',
        'lock',
        'open_cover',
        'press',
        'select_option',
        'set_hvac_mode',
        'set_percentage',
        'set_position',
        'set_preset_mode',
        'set_temperature',
        'set_value',
        'stop_cover',
        'toggle',
        'turn_off',
        'turn_on',
        'unlock',
      ],
      platforms: [
        'alarm_control_panel',
        'binary_sensor',
        'button',
        'climate',
        'cover',
        'event',
        'fan',
        'light',
        'lock',
        'number',
        'select',
        'sensor',
        'siren',
        'switch',
        'valve',
      ],
      controls: 'delegated only to an injected client.execute or commandExecutor',
    },
    localApi: {
      implemented: [
        'manual local setup for host/auth metadata, snapshots, raw pyHomee settings/nodes/attributes data, snapshotProvider, and injected native clients',
        'runtime mapping of Homee nodes and attributes to supported device/entity snapshots',
        'safe Homee control delegation to injected client.execute or commandExecutor only',
      ],
      explicitUnsupported: [
        'native pyHomee websocket authentication, reconnect loop, and dynamic node callbacks in this TypeScript package',
        'claiming Homee attribute set_value or platform command success without an injected client.execute or commandExecutor',
        'Home Assistant device registry cleanup and dynamic entity add/remove side effects',
      ],
    },
  },
};
