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

export const lookinDomain = "lookin";
export const lookinDefaultName = "LOOKin";

export type TLookinRawData = TSimpleLocalRawData;
export interface ILookinSnapshot extends ISimpleLocalSnapshot {}
export interface ILookinConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}
export interface IHomeAssistantLookinConfig extends ILookinConfig {}

export const lookinProfile: ISimpleLocalIntegrationProfile = {
  domain: lookinDomain,
  displayName: "LOOKin",
  manufacturer: "LOOKin",
  model: "LOOKin local integration",
  defaultName: lookinDefaultName,
  defaultPort: 80,
  defaultHttpPath: '/device',
  defaultProtocol: 'http',
  status: "control-runtime",
  platforms: [
    "climate",
    "light",
    "media_player",
    "sensor",
  ],
  serviceDomains: [
    "climate",
    "light",
    "media_player",
  ],
  controlServices: [
    "media_next_track",
    "media_previous_track",
    "select_source",
    "set_fan_mode",
    "set_hvac_mode",
    "set_swing_mode",
    "set_temperature",
    "toggle",
    "turn_off",
    "turn_on",
    "volume_mute",
    "volume_down",
    "volume_up",
  ],
  discoverySources: [
    'manual',
    'mdns',
    'http',
    'custom',
  ],
  discoveryKeywords: [
    "lookin",
    "LOOKin",
    "Lookin",
    "_lookin._tcp.local.",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/lookin",
    "upstreamDomain": "lookin",
    "integrationType": "hub",
    "iotClass": "local_push",
    "requirements": [
      "aiolookin==1.0.0",
    ],
    "codeowners": [
      "@ANMalko",
      "@bdraco",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/lookin",
    "loggers": [
      "aiolookin",
    ],
    "runtime": {
      "type": "control-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
        "media_next_track",
        "media_previous_track",
        "select_source",
        "set_fan_mode",
        "set_hvac_mode",
        "set_swing_mode",
        "set_temperature",
        "toggle",
        "turn_off",
        "turn_on",
        "volume_mute",
        "volume_down",
        "volume_up",
      ],
      "platforms": [
        "climate",
        "light",
        "media_player",
        "sensor",
      ],
      "controls": "direct local LOOKin HTTP command endpoints when config.host/config.url is set, or delegated to an injected client.execute or commandExecutor",
    },
    "localApi": {
      "implemented": [
        "manual local setup for LOOKin endpoints, snapshots, rawData, snapshotProvider, and injected native clients",
        "native local HTTP polling for GET /device, /data, /data/{uuid}, and /sensors/meteo using the documented aiolookin endpoint constants",
        "native local HTTP controls for /commands/ir/localremote/{uuid}{command}{signal} and /commands/ir/localremote/{uuid}{status}",
        "runtime mapping for LOOKin device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor only",
      ],
      "explicitUnsupported": [
        "LOOKin UDP push subscription listener on port 61201; native runtime uses HTTP polling/control only",
        "LOOKin raw/prontohex IR send endpoints because Home Assistant lookin entities do not expose those as standard services",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success without a reachable LOOKin local HTTP endpoint, injected client.execute, or commandExecutor",
      ],
    },
  },
};
