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

export const panasonicBlurayDomain = "panasonic_bluray";
export const panasonicBlurayDefaultName = "Panasonic Blu-Ray Player";
export const panasonicBlurayDefaultPort = 80;

export type TPanasonicBlurayRawData = TSimpleLocalRawData;
export interface IPanasonicBluraySnapshot extends ISimpleLocalSnapshot {}
export interface IPanasonicBlurayConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
  playerVariant?: 'auto' | 'bd' | 'ub';
  variant?: 'auto' | 'bd' | 'ub';
}
export interface IHomeAssistantPanasonicBlurayConfig extends IPanasonicBlurayConfig {}

export const panasonicBlurayProfile: ISimpleLocalIntegrationProfile = {
  domain: panasonicBlurayDomain,
  displayName: "Panasonic Blu-Ray Player",
  manufacturer: "Panasonic Blu-Ray Player",
  model: "Panasonic Blu-Ray Player local integration",
  defaultName: panasonicBlurayDefaultName,
  defaultPort: panasonicBlurayDefaultPort,
  defaultProtocol: 'http',
  status: "control-runtime",
  platforms: [
    "media_player",
  ],
  serviceDomains: [
    "media_player",
  ],
  controlServices: [
    "turn_off",
    "turn_on",
    "media_pause",
    "media_play",
    "media_stop",
  ],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "panasonic_bluray",
    "Panasonic Blu-Ray Player",
    "Panasonic Bluray",
    "Panasonic",
    "Blu-Ray",
    "Player",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/panasonic_bluray",
    "upstreamDomain": "panasonic_bluray",
    "iotClass": "local_polling",
    "qualityScale": "legacy",
    "requirements": [
      "panacotta==0.2",
    ],
    "configFlow": false,
    "documentation": "https://www.home-assistant.io/integrations/panasonic_bluray",
    "loggers": [
      "panacotta",
    ],
    "runtime": {
      "type": "control-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
        "turn_off",
        "turn_on",
        "media_pause",
        "media_play",
        "media_stop",
      ],
      "platforms": [
        "media_player",
      ],
      "controls": "native local panacotta-compatible HTTP when config.host/config.url is set; otherwise delegated to an injected client.execute or commandExecutor",
    },
    "localApi": {
      "implemented": [
        "native HTTP polling and controls through the Panasonic /WAN/dvdr/dvdr_ctrl.cgi API used by Home Assistant's panacotta dependency",
        "manual local setup for Panasonic Blu-Ray Player endpoints, snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for live Panasonic Blu-Ray media_player snapshots and Home Assistant platform metadata",
        "safe fallback command delegation to injected client.execute or commandExecutor",
      ],
      "explicitUnsupported": [
        "volume controls; Home Assistant exposes power, play, pause, and stop only for panasonic_bluray",
        "cloud, pairing, TLS, UDP, serial, or undocumented binary transports not present in the Home Assistant integration or panacotta client",
        "cross-subnet operation; Home Assistant documentation states the player must be on the same subnet",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success without injected client.execute or commandExecutor",
      ],
    },
  },
};
