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

export const igloDomain = 'iglo';
export const igloDefaultName = 'iGlo Light';
export const igloDefaultPort = 8080;

export type TIgloRawData = TSimpleLocalRawData;
export interface IIgloSnapshot extends ISimpleLocalSnapshot {}
export interface IIgloConfig extends ISimpleLocalConfig {
  lightId?: number;
}
export interface IHomeAssistantIgloConfig extends IIgloConfig {}

export const igloProfile: ISimpleLocalIntegrationProfile = {
  domain: igloDomain,
  displayName: 'iGlo',
  manufacturer: 'iGlo',
  model: 'iGlo Light',
  defaultName: igloDefaultName,
  defaultPort: igloDefaultPort,
  defaultProtocol: 'local',
  status: 'read-only-runtime',
  platforms: [
    'light',
  ],
  serviceDomains: [
    'light',
  ],
  controlServices: [
    'turn_on',
    'turn_off',
  ],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    'iglo',
    'iGlo',
    'lamp',
    'light',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/iglo',
    upstreamDomain: 'iglo',
    iotClass: 'local_polling',
    qualityScale: 'legacy',
    requirements: [
      'iglo==1.2.7',
    ],
    dependencies: [],
    afterDependencies: [],
    codeowners: [],
    configFlow: false,
    documentation: 'https://www.home-assistant.io/integrations/iglo',
    loggers: [
      'iglo',
    ],
    defaults: {
      port: igloDefaultPort,
      lightId: 0,
      brightnessScale: 200,
      brightness255Scale: 255,
      colorModes: ['color_temp', 'hs'],
    },
    homeAssistantPlatforms: [
      'light',
    ],
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
        'turn_on',
        'turn_off',
      ],
      platforms: [
        'light',
      ],
      controls: 'delegated only to an injected client.execute or commandExecutor',
    },
    localApi: {
      implemented: [
        'manual local light setup from host, port, snapshots, rawData, snapshotProvider, and injected native clients',
        'runtime mapping for iGlo light state snapshots including brightness, color temperature, HS color, and effects',
        'safe light control delegation to injected client.execute or commandExecutor only',
      ],
      explicitUnsupported: [
        'opening iglo Lamp sessions without an injected native client or snapshotProvider',
        'claiming light switch, brightness, color, color temperature, or effect write success without injected client.execute or commandExecutor',
      ],
    },
  },
};
