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

export const eufylifeBleDomain = 'eufylife_ble';
export const eufylifeBleDefaultName = 'EufyLife';

export type TEufylifeBleRawData = TSimpleLocalRawData;
export interface IEufylifeBleSnapshot extends ISimpleLocalSnapshot {}
export interface IEufylifeBleConfig extends ISimpleLocalConfig {
  address?: string;
  model?: string;
}
export interface IHomeAssistantEufylifeBleConfig extends IEufylifeBleConfig {}

export const eufylifeBleProfile: ISimpleLocalIntegrationProfile = {
  domain: 'eufylife_ble',
  displayName: 'EufyLife',
  manufacturer: 'Eufy',
  model: 'EufyLife BLE device',
  defaultName: eufylifeBleDefaultName,
  defaultProtocol: 'local',
  status: 'read-only-runtime',
  platforms: [
    'sensor',
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'bluetooth',
    'custom',
  ],
  discoveryKeywords: [
    'eufylife',
    'eufy',
    'eufy t9140',
    'eufy t9146',
    'eufy t9147',
    'eufy t9148',
    'eufy t9149',
    'bluetooth scale',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/eufylife_ble',
    upstreamDomain: 'eufylife_ble',
    integrationType: 'device',
    iotClass: 'local_push',
    qualityScale: undefined,
    requirements: [
      'eufylife-ble-client==0.1.8',
    ],
    dependencies: [
      'bluetooth_adapters',
    ],
    afterDependencies: [],
    codeowners: [
      '@bdr99',
    ],
    configFlow: true,
    bluetooth: [
      { local_name: 'eufy T9140' },
      { local_name: 'eufy T9146' },
      { local_name: 'eufy T9147' },
      { local_name: 'eufy T9148' },
      { local_name: 'eufy T9149' },
    ],
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
      ],
      platforms: [
        'sensor',
      ],
      controls: false,
    },
    localApi: {
      implemented: [
        'manual Bluetooth snapshot setup from discovered device metadata, snapshots, rawData, snapshotProvider, and injected native clients',
        'generic local read runtime for EufyLife weight, real-time weight, and heart-rate sensor snapshots',
      ],
      explicitUnsupported: [
        'claiming live command success without injected client.execute or commandExecutor',
        'active BLE connection management without an injected native client or snapshotProvider',
        'cloud account flows and remote API polling',
      ],
    },
  },
};
