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

export const motionBlindsDomain = "motion_blinds";
export const motionBlindsDefaultName = "Motionblinds";

export type TMotionBlindsRawData = TSimpleLocalRawData;
export interface IMotionBlindsSnapshot extends ISimpleLocalSnapshot {}
export interface IMotionBlindsConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}
export interface IHomeAssistantMotionBlindsConfig extends IMotionBlindsConfig {}

export const motionBlindsProfile: ISimpleLocalIntegrationProfile = {
  domain: motionBlindsDomain,
  displayName: "Motionblinds",
  manufacturer: "Motionblinds",
  model: "Motionblinds local integration",
  defaultName: motionBlindsDefaultName,
  defaultProtocol: 'local',
  status: "control-runtime",
  platforms: [
    "button",
    "cover",
    "sensor",
  ],
  serviceDomains: [
    "button",
    "cover",
  ],
  controlServices: [
    "close_cover",
    "open_cover",
    "press",
    "set_absolute_position",
    "stop_cover",
  ],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "motion_blinds",
    "Motionblinds",
    "Motion Blinds",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/motion_blinds",
    "upstreamDomain": "motion_blinds",
    "integrationType": "hub",
    "iotClass": "local_push",
    "requirements": [
      "motionblinds==0.6.30",
    ],
    "dependencies": [
      "network",
    ],
    "codeowners": [
      "@starkillerOG",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/motion_blinds",
    "loggers": [
      "motionblinds",
    ],
    "runtime": {
      "type": "control-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
        "close_cover",
        "open_cover",
        "press",
        "set_absolute_position",
        "stop_cover",
      ],
      "platforms": [
        "button",
        "cover",
        "sensor",
      ],
      "controls": "delegated only to an injected client.execute or commandExecutor",
    },
    "localApi": {
      "implemented": [
        "manual local setup for Motionblinds endpoints, snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for Motionblinds device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor only",
      ],
      "explicitUnsupported": [
        "native live Motionblinds gateway polling or control because the documented Home Assistant library communicates over UDP port 32100 and multicast UDP port 32101",
        "Motionblinds multicast listener, gateway discovery, and AES AccessToken command transport without an injected UDP-capable native client or commandExecutor",
        "claiming live Motionblinds polling, pairing, subscription, or write success without an injected native client or snapshotProvider",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success without injected client.execute or commandExecutor",
      ],
    },
  },
};
