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

export const control4Domain = 'control4';
export const control4DefaultName = 'Control4';

export type TControl4RawData = TSimpleLocalRawData;
export interface IControl4Snapshot extends ISimpleLocalSnapshot {}
export interface IControl4Config extends ISimpleLocalConfig {}
export interface IHomeAssistantControl4Config extends IControl4Config {}

export const control4Profile: ISimpleLocalIntegrationProfile = {
  domain: 'control4',
  displayName: 'Control4',
  manufacturer: 'Control4',
  model: 'Controller',
  defaultName: 'Control4',
  defaultProtocol: 'local',
  status: 'control-runtime',
  platforms: [
    'light',
    'switch',
    'media_player',
    'sensor',
  ],
  serviceDomains: [
    'light',
    'switch',
    'media_player',
  ],
  controlServices: [
    'turn_on',
    'turn_off',
    'toggle',
    'set_level',
    'volume_up',
    'volume_down',
    'volume_mute',
    'select_source',
    'media_play',
    'media_pause',
    'media_stop',
    'media_next_track',
    'media_previous_track',
  ],
  discoverySources: [
    'manual',
    'mdns',
    'ssdp',
    'http',
    'custom',
  ],
  discoveryKeywords: [
    'control4',
    'controller',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/control4',
    upstreamDomain: 'control4',
    integrationType: 'hub',
    iotClass: 'local_polling',
    requirements: [
      'pyControl4==1.5.0',
    ],
    dependencies: [],
    afterDependencies: [],
    codeowners: [
      '@lawtancool',
      '@davidrecordon',
    ],
    configFlow: true,
    runtime: {
      type: 'control-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
        'turn_on',
        'turn_off',
        'toggle',
        'set_level',
        'volume_up',
        'volume_down',
        'volume_mute',
        'select_source',
        'media_play',
        'media_pause',
        'media_stop',
        'media_next_track',
        'media_previous_track',
      ],
      platforms: [
        'light',
        'switch',
        'media_player',
        'sensor',
      ],
      controls: true,
    },
    localApi: {
      implemented: [
        'manual local endpoint setup',
        'snapshot, raw data, snapshotProvider, and injected native client operation',
        'generic HTTP/TCP local transport when config.path, config.transport, or documented defaults are supplied',
      ],
      explicitUnsupported: [
        'claiming live command success without injected client.execute or commandExecutor',
        'cloud account flows and remote API polling',
        'device-specific protocol features not represented by snapshot/rawData/client/executor inputs',
      ],
    },
  },
};
