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

export const coolmasterDomain = 'coolmaster';
export const coolmasterDefaultName = 'CoolMasterNet';

export type TCoolmasterRawData = TSimpleLocalRawData;
export interface ICoolmasterSnapshot extends ISimpleLocalSnapshot {}
export interface ICoolmasterConfig extends ISimpleLocalConfig {}
export interface IHomeAssistantCoolmasterConfig extends ICoolmasterConfig {}

export const coolmasterProfile: ISimpleLocalIntegrationProfile = {
  domain: 'coolmaster',
  displayName: 'CoolMasterNet',
  manufacturer: 'CoolAutomation',
  model: 'CoolMasterNet',
  defaultName: 'CoolMasterNet',
  defaultProtocol: 'local',
  status: 'control-runtime',
  platforms: [
    'climate',
    'fan',
    'sensor',
  ],
  serviceDomains: [
    'climate',
    'fan',
  ],
  controlServices: [
    'set_temperature',
    'set_hvac_mode',
    'set_percentage',
    'turn_on',
    'turn_off',
  ],
  discoverySources: [
    'manual',
    'mdns',
    'ssdp',
    'http',
    'custom',
  ],
  discoveryKeywords: [
    'coolmasternet',
    'coolmaster',
    'hvac',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/coolmaster',
    upstreamDomain: 'coolmaster',
    integrationType: 'hub',
    iotClass: 'local_polling',
    requirements: [
      'pycoolmasternet-async==0.2.4',
    ],
    dependencies: [],
    afterDependencies: [],
    codeowners: [
      '@OnFreund',
    ],
    configFlow: true,
    runtime: {
      type: 'control-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
        'set_temperature',
        'set_hvac_mode',
        'set_percentage',
        'turn_on',
        'turn_off',
      ],
      platforms: [
        'climate',
        'fan',
        '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',
      ],
    },
  },
};
