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

export const btSmarthubDomain = "bt_smarthub";
export const btSmarthubDefaultName = "BT Smart Hub";

export interface IBtSmarthubRawData extends Record<string, unknown> {
  clients?: number;
  wan_up?: boolean;
  wifi_enabled?: boolean;
}

export type TBtSmarthubRawData = IBtSmarthubRawData | TSimpleLocalRawData;
export interface IBtSmarthubSnapshot extends ISimpleLocalSnapshot {}
export interface IBtSmarthubConfig extends ISimpleLocalConfig {
  rawData?: TBtSmarthubRawData;
}
export interface IHomeAssistantBtSmarthubConfig extends IBtSmarthubConfig {}

export const btSmarthubProfile: ISimpleLocalIntegrationProfile = {
  domain: "bt_smarthub",
  displayName: "BT Smart Hub",
  manufacturer: "BT",
  model: "Smart Hub",
  defaultName: "BT Smart Hub",
  defaultProtocol: "local",
  status: "read-only-runtime",
  platforms: [
    "sensor",
    "binary_sensor"
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    "manual",
    "mdns",
    "ssdp",
    "http",
    "custom"
  ],
  discoveryKeywords: [
    "bt",
    "smart hub",
    "router"
  ],
  metadata: {
    source: "home-assistant/core",
    upstreamPath: "homeassistant/components/bt_smarthub",
    upstreamDomain: "bt_smarthub",
    integrationType: "device",
    iotClass: "local_polling",
    qualityScale: "legacy",
    requirements: [
      "btsmarthub-devicelist==0.2.3"
    ],
    dependencies: [],
    afterDependencies: [],
    codeowners: [
      "@typhoon2099"
    ],
    configFlow: true,
    sample: {
      clients: 11,
      wan_up: true,
      wifi_enabled: true
    },
    runtime: {
      type: "read-only-runtime",
      services: [
        "snapshot",
        "status",
        "refresh"
      ],
      platforms: [
        "sensor",
        "binary_sensor"
      ],
      controls: false
    },
    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"
      ]
    }
  }
};
