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

export const goveeBleDomain = 'govee_ble';
export const goveeBleDefaultName = 'Govee Bluetooth';

export type TGoveeBleRawData = TSimpleLocalRawData;
export interface IGoveeBleSnapshot extends ISimpleLocalSnapshot {}
export interface IGoveeBleConfig extends ISimpleLocalConfig {
  address?: string;
  deviceType?: string;
}
export interface IHomeAssistantGoveeBleConfig extends IGoveeBleConfig {}

export const goveeBleProfile: ISimpleLocalIntegrationProfile = {
  domain: 'govee_ble',
  displayName: 'Govee Bluetooth',
  manufacturer: 'Govee',
  model: 'Govee BLE device',
  defaultName: goveeBleDefaultName,
  defaultProtocol: 'local',
  status: 'read-only-runtime',
  platforms: [
    'sensor',
    'binary_sensor',
  ],
  serviceDomains: [
    'sensor',
    'binary_sensor',
    'event',
  ],
  controlServices: [],
  discoverySources: [
    'manual',
    'bluetooth',
    'custom',
  ],
  discoveryKeywords: [
    'govee',
    'govee bluetooth',
    'govee ble',
    'GVH5',
    'B5178',
    'GV5121',
    'GV5122',
    'GV5123',
    'GV5124',
    'GV5125',
    'GV5126',
    'GV5179',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/govee_ble',
    upstreamDomain: 'govee_ble',
    integrationType: 'device',
    iotClass: 'local_push',
    qualityScale: undefined,
    requirements: [
      'govee-ble==1.2.0',
    ],
    dependencies: [
      'bluetooth_adapters',
    ],
    afterDependencies: [],
    codeowners: [
      '@bdraco',
    ],
    configFlow: true,
    documentation: 'https://www.home-assistant.io/integrations/govee_ble',
    bluetooth: [
      { connectable: false, local_name: 'Govee*' },
      { connectable: false, local_name: 'GVH5*' },
      { connectable: false, local_name: 'B5178*' },
      { connectable: false, local_name: 'GV5121*' },
      { connectable: false, local_name: 'GV5122*' },
      { connectable: false, local_name: 'GV5123*' },
      { connectable: false, local_name: 'GV5124*' },
      { connectable: false, local_name: 'GV5125*' },
      { connectable: false, local_name: 'GV5126*' },
      { connectable: false, local_name: 'GV5179*' },
      { connectable: false, local_name: 'GVH5127*' },
      { connectable: false, local_name: 'GVH5130*' },
      { connectable: false, local_name: 'GVH5110*' },
      { connectable: false, local_name: 'GV5140*' },
      { connectable: false, manufacturer_id: 1, service_uuid: '0000ec88-0000-1000-8000-00805f9b34fb' },
      { connectable: false, manufacturer_id: 6966, service_uuid: '00008451-0000-1000-8000-00805f9b34fb' },
      { connectable: false, manufacturer_id: 63391, service_uuid: '00008351-0000-1000-8000-00805f9b34fb' },
      { connectable: false, manufacturer_id: 26589, service_uuid: '00008351-0000-1000-8000-00805f9b34fb' },
      { connectable: false, manufacturer_id: 57391, service_uuid: '00008351-0000-1000-8000-00805f9b34fb' },
      { connectable: false, manufacturer_id: 18994, service_uuid: '00008551-0000-1000-8000-00805f9b34fb' },
      { connectable: false, manufacturer_id: 818, service_uuid: '00008551-0000-1000-8000-00805f9b34fb' },
      { connectable: false, manufacturer_id: 53579, service_uuid: '00008151-0000-1000-8000-00805f9b34fb' },
      { connectable: false, manufacturer_id: 43682, service_uuid: '00008151-0000-1000-8000-00805f9b34fb' },
      { connectable: false, manufacturer_id: 59970, service_uuid: '00008151-0000-1000-8000-00805f9b34fb' },
      { connectable: false, manufacturer_id: 63585, service_uuid: '00008151-0000-1000-8000-00805f9b34fb' },
      { connectable: false, manufacturer_id: 14474, service_uuid: '00008151-0000-1000-8000-00805f9b34fb' },
      { connectable: false, manufacturer_id: 10032, service_uuid: '00008251-0000-1000-8000-00805f9b34fb' },
      { connectable: false, manufacturer_id: 19506, service_uuid: '00001801-0000-1000-8000-00805f9b34fb' },
      { connectable: false, manufacturer_id: 61320 },
      { connectable: false, manufacturer_data_start: [236, 0, 0, 1], manufacturer_id: 34819 },
    ],
    homeAssistantPlatforms: [
      'binary_sensor',
      'event',
      'sensor',
    ],
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
      ],
      platforms: [
        'sensor',
        'binary_sensor',
      ],
      controls: false,
    },
    localApi: {
      implemented: [
        'manual Bluetooth discovery metadata, snapshots, rawData, snapshotProvider, and injected native clients',
        'runtime mapping for common Govee BLE sensor and binary sensor updates',
      ],
      explicitUnsupported: [
        'active BLE scanning or advertisement parsing without an injected client or snapshotProvider',
        'Home Assistant event entities as first-class event platforms because the shared runtime has no event entity platform',
        'claiming live command success without injected client.execute or commandExecutor',
      ],
    },
  },
};
