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

export const ephemberDomain = 'ephember';
export const ephemberDefaultName = 'EPH Controls';

export type TEphemberRawData = TSimpleLocalRawData;
export interface IEphemberSnapshot extends ISimpleLocalSnapshot {}
export interface IEphemberConfig extends ISimpleLocalConfig {
  homes?: Array<Record<string, unknown>>;
  zoneIds?: Array<string | number>;
}
export interface IHomeAssistantEphemberConfig extends IEphemberConfig {}

const ephemberControlServices = [
  'turn_on',
  'turn_off',
  'set_temperature',
  'set_hvac_mode',
];

export const ephemberProfile: ISimpleLocalIntegrationProfile = {
  domain: ephemberDomain,
  displayName: 'EPH Controls',
  manufacturer: 'EPH Controls',
  model: 'Ember',
  defaultName: ephemberDefaultName,
  defaultProtocol: 'local',
  status: 'control-runtime',
  platforms: [
    'climate',
  ],
  serviceDomains: [
    'climate',
  ],
  controlServices: ephemberControlServices,
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    'ephember',
    'eph',
    'ember',
    'thermostat',
    'pyephember2',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/ephember',
    upstreamDomain: 'ephember',
    iotClass: 'local_polling',
    qualityScale: 'legacy',
    requirements: [
      'pyephember2==0.4.12',
    ],
    dependencies: [],
    afterDependencies: [],
    codeowners: [
      '@ttroy50',
      '@roberty99',
    ],
    configFlow: false,
    documentation: 'https://www.home-assistant.io/integrations/ephember',
    haPlatforms: [
      'climate',
    ],
    runtime: {
      type: 'control-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
        ...ephemberControlServices,
      ],
      platforms: [
        'climate',
      ],
      controls: true,
    },
    localApi: {
      implemented: [
        'manual EPH Controls setup with credentials or local data source metadata',
        'snapshot, raw data, snapshotProvider, and injected native EphEmber client operation',
        'executor-gated thermostat mode and target temperature service dispatch',
      ],
      explicitUnsupported: [
        'claiming thermostat command success without injected client.execute or commandExecutor',
        'direct pyephember2 account session operation without an injected native client',
        'background polling of the upstream API without a supplied snapshotProvider or client',
      ],
    },
  },
};
