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

export const ducoDomain = 'duco';
export const ducoDefaultName = 'Duco';

export type TDucoRawData = TSimpleLocalRawData;
export interface IDucoSnapshot extends ISimpleLocalSnapshot {}
export interface IDucoConfig extends ISimpleLocalConfig {}
export interface IHomeAssistantDucoConfig extends IDucoConfig {}

export const ducoProfile: ISimpleLocalIntegrationProfile = {
  domain: 'duco',
  displayName: 'Duco',
  manufacturer: 'Duco',
  model: 'Duco ventilation hub',
  defaultName: 'Duco',
  defaultProtocol: 'local',
  status: 'control-runtime',
  platforms: [
    'fan',
    'sensor',
  ],
  serviceDomains: [
    'fan',
  ],
  controlServices: [
    'turn_on',
    'turn_off',
    'set_percentage',
    'set_preset_mode',
  ],
  discoverySources: [
    'manual',
    'dhcp',
    'mdns',
    'http',
    'custom',
  ],
  discoveryKeywords: [
    'duco',
    'ventilation',
    '_http._tcp.local',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/duco',
    upstreamDomain: 'duco',
    integrationType: 'hub',
    iotClass: 'local_polling',
    qualityScale: 'platinum',
    requirements: [
      'python-duco-client==0.4.0',
    ],
    dependencies: [],
    afterDependencies: [],
    codeowners: [
      '@ronaldvdmeer',
    ],
    configFlow: true,
    dhcp: [
      {
        hostname: 'duco_[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]',
      },
    ],
    zeroconf: [
      {
        name: 'duco [[][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f][]].*',
        type: '_http._tcp.local.',
      },
    ],
    runtime: {
      type: 'control-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
        'turn_on',
        'turn_off',
        'set_percentage',
        'set_preset_mode',
      ],
      platforms: [
        'fan',
        'sensor',
      ],
      controls: true,
    },
    localApi: {
      implemented: [
        'manual local endpoint setup',
        'snapshot, raw data, snapshotProvider, and injected native Duco 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',
      ],
    },
  },
};
