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

export const jvcProjectorDomain = "jvc_projector";
export const jvcProjectorDefaultName = "JVC Projector";

export type TJvcProjectorRawData = TSimpleLocalRawData;
export interface IJvcProjectorSnapshot extends ISimpleLocalSnapshot {}
export interface IJvcProjectorConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}
export interface IHomeAssistantJvcProjectorConfig extends IJvcProjectorConfig {}

export const jvcProjectorProfile: ISimpleLocalIntegrationProfile = {
  domain: jvcProjectorDomain,
  displayName: "JVC Projector",
  manufacturer: "JVC Projector",
  model: "JVC Projector local integration",
  defaultName: jvcProjectorDefaultName,
  defaultPort: 20554,
  defaultProtocol: 'tcp',
  status: "control-runtime",
  platforms: [
    "binary_sensor",
    "button",
    "select",
    "sensor",
    "switch",
  ],
  serviceDomains: [
    "button",
    "remote",
    "select",
    "switch",
  ],
  controlServices: [
    "press",
    "send_command",
    "select_option",
    "toggle",
    "turn_off",
    "turn_on",
  ],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "jvc_projector",
    "JVC Projector",
    "Jvc Projector",
    "JVC",
    "Projector",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/jvc_projector",
    "upstreamDomain": "jvc_projector",
    "integrationType": "device",
    "iotClass": "local_polling",
    "requirements": [
      "pyjvcprojector==2.0.6",
    ],
    "codeowners": [
      "@SteveEasley",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/jvc_projector",
    "loggers": [
      "jvcprojector",
    ],
    "runtime": {
      "type": "control-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
        "press",
        "select_option",
        "toggle",
        "turn_off",
        "turn_on",
      ],
      "platforms": [
        "binary_sensor",
        "button",
        "select",
        "sensor",
        "switch",
      ],
      "controls": "native local TCP PJREQ command control for documented pyjvcprojector commands with injected executor fallback",
    },
    "localApi": {
      "implemented": [
        "native local TCP polling over pyjvcprojector's documented port 20554 PJ_OK/PJREQ/PJACK protocol",
        "native local TCP control for Power, Input, Remote, LowLatencyMode, and EShift command mappings present in pyjvcprojector 2.0.6",
        "runtime mapping for JVC Projector device snapshots and Home Assistant platform metadata",
        "manual snapshots, rawData, snapshotProvider, injected native clients, and commandExecutor fallback",
      ],
      "explicitUnsupported": [
        "TLS transport; Home Assistant pyjvcprojector uses plain local TCP",
        "model-specific pyjvcprojector commands not represented by this native TypeScript command map",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success without a projector protocol ACK, injected client.execute, or commandExecutor",
      ],
    },
  },
};
