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

export const geniushubDomain = 'geniushub';
export const geniushubDefaultName = 'Genius Hub';

export type TGeniushubRawData = TSimpleLocalRawData;
export interface IGeniushubSnapshot extends ISimpleLocalSnapshot {}
export interface IGeniushubConfig extends ISimpleLocalConfig {}
export interface IHomeAssistantGeniushubConfig extends IGeniushubConfig {}

export const geniushubProfile: ISimpleLocalIntegrationProfile = {
  domain: 'geniushub',
  displayName: 'Genius Hub',
  manufacturer: 'Genius Hub',
  model: 'Genius Hub',
  defaultName: geniushubDefaultName,
  defaultProtocol: 'local',
  status: 'read-only-runtime',
  platforms: [
    'binary_sensor',
    'climate',
    'sensor',
    'switch',
  ],
  serviceDomains: [
    'binary_sensor',
    'climate',
    'sensor',
    'switch',
    'water_heater',
  ],
  controlServices: [
    'set_zone_mode',
    'set_zone_override',
    'set_switch_override',
    'set_temperature',
    'set_hvac_mode',
    'set_preset_mode',
    'set_operation_mode',
    'turn_on',
    'turn_off',
  ],
  discoverySources: [
    'manual',
    'http',
    'custom',
  ],
  discoveryKeywords: [
    'genius hub',
    'geniushub',
    'heating',
    'zone',
    'radiator',
    'hot water',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/geniushub',
    upstreamDomain: 'geniushub',
    iotClass: 'local_polling',
    qualityScale: undefined,
    requirements: [
      'geniushub-client==0.7.1',
    ],
    dependencies: [],
    afterDependencies: [],
    codeowners: [
      '@manzanotti',
    ],
    configFlow: true,
    documentation: 'https://www.home-assistant.io/integrations/geniushub',
    loggers: [
      'geniushubclient',
    ],
    homeAssistantPlatforms: [
      'binary_sensor',
      'climate',
      'sensor',
      'switch',
      'water_heater',
    ],
    defaults: {
      scanIntervalSeconds: 60,
      zoneModes: ['off', 'timer', 'footprint'],
      overrideMinTemperature: 4,
      overrideMaxTemperature: 28,
      overrideMinMinutes: 5,
      overrideMaxHours: 24,
    },
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
        'set_zone_mode',
        'set_zone_override',
        'set_switch_override',
        'set_temperature',
        'set_hvac_mode',
        'turn_on',
        'turn_off',
      ],
      platforms: [
        'binary_sensor',
        'climate',
        'sensor',
        'switch',
      ],
      controls: 'delegated only to an injected client.execute or commandExecutor',
    },
    localApi: {
      implemented: [
        'manual local setup for host/user credentials or provided Genius Hub snapshots',
        'runtime mapping for zones, devices, batteries, issues, and on/off zones from raw local data',
        'safe control delegation to injected client.execute or commandExecutor only',
      ],
      explicitUnsupported: [
        'direct geniushub-client HTTP calls from this TypeScript package',
        'claiming zone, switch, climate, or water-heater command success without an injected client.execute or commandExecutor',
        'cloud API token polling without a provided snapshot/client representation',
      ],
    },
  },
};
