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

export const dormakabaDkeyDomain = 'dormakaba_dkey';
export const dormakabaDkeyDefaultName = 'Dormakaba dKey';

export type TDormakabaDkeyRawData = TSimpleLocalRawData;
export interface IDormakabaDkeySnapshot extends ISimpleLocalSnapshot {}
export interface IDormakabaDkeyConfig extends ISimpleLocalConfig {}
export interface IHomeAssistantDormakabaDkeyConfig extends IDormakabaDkeyConfig {}

export const dormakabaDkeyProfile: ISimpleLocalIntegrationProfile = {
  domain: 'dormakaba_dkey',
  displayName: 'Dormakaba dKey',
  manufacturer: 'Dormakaba',
  model: 'MTL 9291',
  defaultName: 'Dormakaba dKey',
  defaultProtocol: 'local',
  status: 'control-runtime',
  platforms: [
    'binary_sensor',
    'sensor',
    'switch',
  ],
  serviceDomains: [
    'lock',
  ],
  controlServices: [
    'lock',
    'unlock',
  ],
  discoverySources: [
    'manual',
    'bluetooth',
    'custom',
  ],
  discoveryKeywords: [
    'dormakaba',
    'dkey',
    'e7a60000-6639-429f-94fd-86de8ea26897',
    'e7a60001-6639-429f-94fd-86de8ea26897',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/dormakaba_dkey',
    upstreamDomain: 'dormakaba_dkey',
    integrationType: 'device',
    iotClass: 'local_polling',
    qualityScale: undefined,
    requirements: [
      'py-dormakaba-dkey==1.0.6',
    ],
    dependencies: [
      'bluetooth_adapters',
    ],
    afterDependencies: [],
    codeowners: [
      '@emontnemery',
    ],
    configFlow: true,
    bluetooth: [
      { service_uuid: 'e7a60000-6639-429f-94fd-86de8ea26897' },
      { service_uuid: 'e7a60001-6639-429f-94fd-86de8ea26897' },
    ],
    runtime: {
      type: 'control-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
        'lock',
        'unlock',
      ],
      platforms: [
        'binary_sensor',
        'sensor',
        'switch',
      ],
      controls: true,
    },
    localApi: {
      implemented: [
        'manual local dKey device setup',
        'bluetooth discovery records and offline association data snapshots',
        'snapshot, raw data, snapshotProvider, and injected native client operation',
      ],
      explicitUnsupported: [
        'claiming live lock or unlock success without injected client.execute or commandExecutor',
        'Bluetooth association and activation-code exchange without an injected native client',
        'device-specific protocol features not represented by snapshot/rawData/client/executor inputs',
      ],
    },
  },
};
