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

export const izoneDomain = "izone";
export const izoneDefaultName = "iZone";

export type TIzoneRawData = TSimpleLocalRawData;
export interface IIzoneSnapshot extends ISimpleLocalSnapshot {}
export interface IIzoneConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
  isV2?: boolean;
  isIPower?: boolean;
}
export interface IHomeAssistantIzoneConfig extends IIzoneConfig {}

export const izoneProfile: ISimpleLocalIntegrationProfile = {
  domain: izoneDomain,
  displayName: "iZone",
  manufacturer: "iZone",
  model: "iZone local integration",
  defaultName: izoneDefaultName,
  defaultPort: 80,
  defaultProtocol: 'http',
  status: "control-runtime",
  platforms: [
    "climate",
  ],
  serviceDomains: [
    "climate",
  ],
  controlServices: [
    "airflow_max",
    "airflow_min",
    "set_hvac_mode",
    "set_temperature",
  ],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "izone",
    "iZone",
    "Izone",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/izone",
    "upstreamDomain": "izone",
    "integrationType": "hub",
    "iotClass": "local_polling",
    "requirements": [
      "python-izone==1.2.9",
    ],
    "codeowners": [
      "@Swamp-Ig",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/izone",
    "loggers": [
      "pizone",
    ],
    "runtime": {
      "type": "control-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
        "airflow_max",
        "airflow_min",
        "set_hvac_mode",
        "set_temperature",
      ],
      "platforms": [
        "climate",
      ],
      "controls": "native iZone HTTP/TCP control when host/url is configured; otherwise delegated to an injected client.execute or commandExecutor",
    },
    "localApi": {
      "implemented": [
        "native HTTP polling of documented iZone SystemSettings and Zones1_4/Zones5_8/Zones9_12 resources when host/url is configured",
        "native raw TCP HTTP POST commands for SystemON, SystemMODE, SystemFAN, UnitSetpoint, ZoneCommand, AirMinCommand, AirMaxCommand, and FreeAir",
        "manual snapshots, rawData, snapshotProvider, and injected native clients remain supported when no host/url is configured",
      ],
      "explicitUnsupported": [
        "UDP broadcast discovery/listening on ports 12107 and 7005; configure host/url explicitly or inject a discovery/client implementation",
        "iZone lights, reticulation, power monitor entities, schedules, and non-climate devices outside the documented climate HTTP resources",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success when neither iZone host/url nor injected client.execute/commandExecutor is configured",
      ],
    },
  },
};
