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

export const dropConnectDomain = 'drop_connect';
export const dropConnectDefaultName = 'DROP';

export type TDropConnectRawData = TSimpleLocalRawData;
export interface IDropConnectSnapshot extends ISimpleLocalSnapshot {}
export interface IDropConnectConfig extends ISimpleLocalConfig {}
export interface IHomeAssistantDropConnectConfig extends IDropConnectConfig {}

export const dropConnectProfile: ISimpleLocalIntegrationProfile = {
  domain: 'drop_connect',
  displayName: 'DROP',
  manufacturer: 'Chandler Systems, Inc.',
  model: 'DROP Connect',
  defaultName: 'DROP',
  defaultProtocol: 'mqtt',
  status: 'control-runtime',
  platforms: [
    'binary_sensor',
    'select',
    'sensor',
    'switch',
  ],
  serviceDomains: [
    'select',
    'switch',
  ],
  controlServices: [
    'turn_on',
    'turn_off',
    'select_option',
    'set_water',
    'set_bypass',
    'set_protect_mode',
  ],
  discoverySources: [
    'manual',
    'mqtt',
    'custom',
  ],
  discoveryKeywords: [
    'drop',
    'drop connect',
    'chandler',
    'water',
    'dropmqttapi',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/drop_connect',
    upstreamDomain: 'drop_connect',
    integrationType: 'hub',
    iotClass: 'local_push',
    qualityScale: 'legacy',
    requirements: [
      'dropmqttapi==1.0.3',
    ],
    dependencies: [
      'mqtt',
    ],
    afterDependencies: [],
    codeowners: [
      '@ChandlerSystems',
      '@pfrazer',
    ],
    configFlow: true,
    mqttDiscoveryTopic: 'drop_connect/discovery/#',
    homeAssistantPlatforms: [
      'binary_sensor',
      'select',
      'sensor',
      'switch',
    ],
    runtime: {
      type: 'control-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
        'turn_on',
        'turn_off',
        'select_option',
        'set_water',
        'set_bypass',
        'set_protect_mode',
      ],
      platforms: [
        'binary_sensor',
        'select',
        'sensor',
        'switch',
      ],
      controls: true,
    },
    localApi: {
      implemented: [
        'manual MQTT/local setup from discovery records or raw snapshots',
        'snapshot, raw data, snapshotProvider, and injected native client operation',
        'DROP control requests through injected client.execute or commandExecutor only',
      ],
      explicitUnsupported: [
        'claiming live DROP MQTT command success without injected client.execute or commandExecutor',
        'subscribing to or parsing live DROP MQTT traffic without a provided client/snapshot source',
        'device-specific protocol features not represented by snapshot/rawData/client/executor inputs',
      ],
    },
  },
};
