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

export const dynaliteDomain = 'dynalite';
export const dynaliteDefaultName = 'Philips Dynalite';

export type TDynaliteRawData = TSimpleLocalRawData;
export interface IDynaliteSnapshot extends ISimpleLocalSnapshot {}
export interface IDynaliteConfig extends ISimpleLocalConfig {}
export interface IHomeAssistantDynaliteConfig extends IDynaliteConfig {}

export const dynaliteProfile: ISimpleLocalIntegrationProfile = {
  domain: 'dynalite',
  displayName: 'Philips Dynalite',
  manufacturer: 'Dynalite',
  model: 'Dynalite gateway',
  defaultName: 'Philips Dynalite',
  defaultPort: 12345,
  defaultProtocol: 'tcp',
  status: 'control-runtime',
  platforms: [
    'cover',
    'light',
    'switch',
  ],
  serviceDomains: [],
  controlServices: [
    'request_area_preset',
    'request_channel_level',
    'turn_on',
    'turn_off',
    'toggle',
    'set_level',
    'open_cover',
    'close_cover',
    'stop_cover',
  ],
  discoverySources: [
    'manual',
    'mdns',
    'ssdp',
    'http',
    'custom',
  ],
  discoveryKeywords: [
    'dynalite',
    'dynet',
    'philips',
    'gateway',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/dynalite',
    upstreamDomain: 'dynalite',
    iotClass: 'local_push',
    qualityScale: undefined,
    requirements: [
      'dynalite-devices==0.1.47',
      'dynalite-panel==0.0.4',
    ],
    dependencies: [
      'http',
      'websocket_api',
    ],
    afterDependencies: [
      'panel_custom',
    ],
    codeowners: [
      '@ziv1234',
    ],
    configFlow: true,
    runtime: {
      type: 'control-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
        'request_area_preset',
        'request_channel_level',
      ],
      platforms: [
        'cover',
        'light',
        'switch',
      ],
      controls: true,
    },
    localApi: {
      implemented: [
        'manual local gateway setup on TCP port 12345',
        'snapshot, raw data, snapshotProvider, and injected native client operation',
        'executor-routed Dynalite request/control services when client.execute or commandExecutor is supplied',
      ],
      explicitUnsupported: [
        'claiming live Dynalite command success without injected client.execute or commandExecutor',
        'frontend configuration panel websocket APIs from dynalite-panel',
        'autogenerated Dynalite device discovery beyond supplied snapshot/rawData/client/executor inputs',
      ],
    },
  },
};
