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

export const picottsDomain = "picotts";
export const picottsDefaultName = "Pico TTS";

export type TPicottsRawData = TSimpleLocalRawData;
export interface IPicottsSnapshot extends ISimpleLocalSnapshot {}
export interface IPicottsConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
}
export interface IHomeAssistantPicottsConfig extends IPicottsConfig {}

export const picottsProfile: ISimpleLocalIntegrationProfile = {
  domain: picottsDomain,
  displayName: "Pico TTS",
  manufacturer: "Pico TTS",
  model: "Pico TTS local integration",
  defaultName: picottsDefaultName,
  defaultProtocol: 'local',
  status: "read-only-runtime",
  platforms: [
    "sensor",
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "picotts",
    "Pico TTS",
    "Picotts",
    "Pico",
    "TTS",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/picotts",
    "upstreamDomain": "picotts",
    "integrationType": "service",
    "iotClass": "local_push",
    "requirements": [],
    "codeowners": [
      "@rooggiieerr",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/picotts",
    "runtime": {
      "type": "read-only-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
      ],
      "platforms": [
        "sensor",
      ],
      "controls": false,
    },
    "localApi": {
      "status": "native live Pico TTS synthesis is unsupported here because Home Assistant shells out to the external pico2wave OS command and reads a generated temporary WAV file; this package only uses existing fetch/net/tls/fs helpers and does not provide subprocess command execution",
      "implemented": [
        "manual local setup for Pico TTS snapshots, rawData, snapshotProvider, and injected native clients",
        "runtime mapping for Pico TTS device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor only; no native synthesis success is claimed",
      ],
      "explicitUnsupported": [
        "native Pico TTS get_tts_audio/synthesis because HA requires the pico2wave OS executable invoked through subprocess plus temporary WAV file output, not a direct HTTP/TCP/TLS/file protocol available with existing dependencies",
        "claiming live Pico TTS 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",
      ],
    },
  },
};
