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

export const nfandroidtvDomain = "nfandroidtv";
export const nfandroidtvDefaultName = "Notifications for Android TV / Fire TV";

export type TNfandroidtvRawData = TSimpleLocalRawData;
export interface INfandroidtvSnapshot extends ISimpleLocalSnapshot {}
export interface INfandroidtvConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}
export interface IHomeAssistantNfandroidtvConfig extends INfandroidtvConfig {}

export const nfandroidtvProfile: ISimpleLocalIntegrationProfile = {
  domain: nfandroidtvDomain,
  displayName: "Notifications for Android TV / Fire TV",
  manufacturer: "Notifications for Android TV / Fire TV",
  model: "Notifications for Android TV / Fire TV local integration",
  defaultName: nfandroidtvDefaultName,
  defaultPort: 7676,
  defaultHttpPath: '/',
  defaultProtocol: 'http',
  status: "control-runtime",
  platforms: [
    "sensor",
  ],
  serviceDomains: [
    "notify",
  ],
  controlServices: [
    "send",
    "send_message",
    "notify",
  ],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "nfandroidtv",
    "Notifications for Android TV / Fire TV",
    "Nfandroidtv",
    "Notifications",
    "for",
    "Android",
    "TV",
    "/",
    "Fire",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/nfandroidtv",
    "upstreamDomain": "nfandroidtv",
    "integrationType": "service",
    "iotClass": "local_push",
    "requirements": [
      "notifications-android-tv==0.1.5",
    ],
    "codeowners": [
      "@tkdrob",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/nfandroidtv",
    "loggers": [
      "notifications_android_tv",
    ],
    "runtime": {
      "type": "control-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
        "send",
        "send_message",
        "notify",
      ],
      "platforms": [
        "sensor",
      ],
      "controls": "native HTTP multipart notification delivery on TCP port 7676 when host is configured",
    },
    "localApi": {
      "implemented": [
        "live Notifications for Android TV / Fire TV reachability checks over HTTP port 7676",
        "live multipart notification delivery compatible with notifications-android-tv send()",
        "manual local setup for Notifications for Android TV / Fire TV endpoints, snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for Notifications for Android TV / Fire TV device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor when no host is configured",
      ],
      "explicitUnsupported": [
        "Android TV pairing, DIAL discovery validation, or subscription flows",
        "Home Assistant allowlist checks and authenticated remote image/icon fetching before notification delivery",
        "Home Assistant entity registry migrations and repair flows",
        "claiming notification delivery success without a live HTTP 200 response or injected command executor",
      ],
    },
  },
};
