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

export const fjaraskupanDomain = 'fjaraskupan';
export const fjaraskupanDefaultName = 'Fjaraskupan';

export type TFjaraskupanRawData = TSimpleLocalRawData;
export interface IFjaraskupanSnapshot extends ISimpleLocalSnapshot {}
export interface IFjaraskupanConfig extends ISimpleLocalConfig {
  address?: string;
  macAddress?: string;
}
export interface IHomeAssistantFjaraskupanConfig extends IFjaraskupanConfig {}

export const fjaraskupanProfile: ISimpleLocalIntegrationProfile = {
  domain: 'fjaraskupan',
  displayName: 'Fjaraskupan',
  manufacturer: 'Fjaraskupan',
  model: 'Bluetooth cooker hood',
  defaultName: fjaraskupanDefaultName,
  defaultProtocol: 'local',
  status: 'read-only-runtime',
  platforms: [
    'binary_sensor',
    'fan',
    'light',
    'number',
    'sensor',
  ],
  serviceDomains: [
    'fan',
    'light',
    'number',
  ],
  controlServices: [
    'set_brightness',
    'set_percentage',
    'set_preset_mode',
    'set_value',
    'turn_off',
    'turn_on',
  ],
  discoverySources: [
    'manual',
    'bluetooth',
    'custom',
  ],
  discoveryKeywords: [
    'fjaraskupan',
    'odfjar',
    'bluetooth',
    'cooker hood',
    'range hood',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/fjaraskupan',
    upstreamDomain: 'fjaraskupan',
    integrationType: 'hub',
    iotClass: 'local_polling',
    qualityScale: undefined,
    requirements: [
      'fjaraskupan==2.3.3',
    ],
    dependencies: [
      'bluetooth_adapters',
    ],
    afterDependencies: [],
    codeowners: [
      '@elupus',
    ],
    configFlow: true,
    documentation: 'https://www.home-assistant.io/integrations/fjaraskupan',
    bluetooth: {
      manufacturerId: 20296,
      manufacturerDataStart: [79, 68, 70, 74, 65, 82],
      connectable: false,
    },
    platforms: [
      'binary_sensor',
      'fan',
      'light',
      'number',
      'sensor',
    ],
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
        'set_brightness',
        'set_percentage',
        'set_preset_mode',
        'set_value',
        'turn_off',
        'turn_on',
      ],
      platforms: [
        'binary_sensor',
        'fan',
        'light',
        'number',
        'sensor',
      ],
      controls: 'delegated only to an injected client.execute or commandExecutor',
    },
    localApi: {
      implemented: [
        'manual local setup for Bluetooth address metadata, snapshots, raw data, snapshotProvider, and injected native clients',
        'runtime device and entity mapping for fan, light, number, diagnostic sensor, and filter binary sensor snapshots',
        'safe control delegation to injected client.execute or commandExecutor only',
      ],
      explicitUnsupported: [
        'native Bluetooth LE connection and fjaraskupan command transport in this TypeScript package',
        'claiming fan, light, or periodic venting write success without an injected client.execute or commandExecutor',
        'Home Assistant Bluetooth rediscovery callbacks and live advertisement subscriptions',
      ],
    },
  },
};
