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

export const lutronCasetaDomain = "lutron_caseta";
export const lutronCasetaDefaultName = "Lutron Caseta";

export type TLutronCasetaRawData = TSimpleLocalRawData;
export interface ILutronCasetaSnapshot extends ISimpleLocalSnapshot {}
export interface ILutronCasetaConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}
export interface IHomeAssistantLutronCasetaConfig extends ILutronCasetaConfig {}

export const lutronCasetaProfile: ISimpleLocalIntegrationProfile = {
  domain: lutronCasetaDomain,
  displayName: "Lutron Caseta",
  manufacturer: "Lutron Caseta",
  model: "Lutron Caseta local integration",
  defaultName: lutronCasetaDefaultName,
  defaultProtocol: 'local',
  status: "read-only-runtime",
  platforms: [
    "binary_sensor",
    "button",
    "cover",
    "fan",
    "light",
    "switch",
  ],
  serviceDomains: [
    "button",
    "cover",
    "fan",
    "light",
    "switch",
  ],
  controlServices: [
    "close_cover",
    "open_cover",
    "press",
    "stop_cover",
    "toggle",
    "turn_off",
    "turn_on",
  ],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "lutron_caseta",
    "Lutron Caseta",
    "Lutron",
    "Caseta",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/lutron_caseta",
    "upstreamDomain": "lutron_caseta",
    "integrationType": "hub",
    "iotClass": "local_push",
    "requirements": [
      "pylutron-caseta==0.28.0",
    ],
    "codeowners": [
      "@swails",
      "@danaues",
      "@eclair4151",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/lutron_caseta",
    "loggers": [
      "pylutron_caseta",
    ],
    "runtime": {
      "type": "read-only-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
        "close_cover",
        "open_cover",
        "press",
        "stop_cover",
        "toggle",
        "turn_off",
        "turn_on",
      ],
      "platforms": [
        "binary_sensor",
        "button",
        "cover",
        "fan",
        "light",
        "switch",
      ],
      "controls": "native LEAP control is not implemented because setup requires Lutron pairing and mutual-TLS certificate assets; controls are delegated only to an injected client.execute or commandExecutor",
    },
    "localApi": {
      "status": "native LEAP blocked: protocol requires Lutron pairing-generated keyfile/certfile/ca_certs and pylutron-caseta pairing semantics are not implemented with existing dependencies",
      "implemented": [
        "manual local setup for Lutron Caseta endpoints, snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for Lutron Caseta device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor only",
      ],
      "explicitUnsupported": [
        "native Lutron Caseta/RA2 Select/RadioRA 3/HomeWorks QSX LEAP connection because it requires pairing-generated mutual-TLS keyfile/certfile/ca_certs and pylutron-caseta pairing behavior is unavailable here",
        "LEAP push subscriptions and live control without an injected native client because pairing and certificate lifecycle are not implemented",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success without injected client.execute or commandExecutor",
      ],
    },
  },
};
