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

export const greenwaveDomain = 'greenwave';
export const greenwaveDefaultName = 'Greenwave Reality';

export type TGreenwaveRawData = TSimpleLocalRawData;
export interface IGreenwaveSnapshot extends ISimpleLocalSnapshot {}
export interface IGreenwaveConfig extends ISimpleLocalConfig {
  version?: number;
}
export interface IHomeAssistantGreenwaveConfig extends IGreenwaveConfig {}

export const greenwaveProfile: ISimpleLocalIntegrationProfile = {
  domain: 'greenwave',
  displayName: 'Greenwave Reality',
  manufacturer: 'Greenwave Reality',
  model: 'TCP Connected gateway',
  defaultName: greenwaveDefaultName,
  defaultProtocol: 'http',
  status: 'read-only-runtime',
  platforms: [
    'light',
  ],
  serviceDomains: [
    'light',
  ],
  controlServices: [
    'set_brightness',
    'set_level',
    'set_value',
    'toggle',
    'turn_off',
    'turn_on',
  ],
  discoverySources: [
    'manual',
    'http',
    'custom',
  ],
  discoveryKeywords: [
    'greenwave',
    'greenwave reality',
    'tcp connected',
    'gateway',
    'bulb',
    'light',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/greenwave',
    upstreamDomain: 'greenwave',
    iotClass: 'local_polling',
    qualityScale: 'legacy',
    requirements: [
      'greenwavereality==0.5.1',
    ],
    dependencies: [],
    afterDependencies: [],
    codeowners: [],
    configFlow: false,
    documentation: 'https://www.home-assistant.io/integrations/greenwave',
    loggers: [
      'greenwavereality',
    ],
    homeAssistantPlatforms: [
      'light',
    ],
    defaults: {
      supportedVersions: [2, 3],
      tokenFile: '.greenwave',
      colorMode: 'brightness',
    },
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
        'set_brightness',
        'set_level',
        'set_value',
        'toggle',
        'turn_off',
        'turn_on',
      ],
      platforms: [
        'light',
      ],
      controls: 'delegated only to an injected client.execute or commandExecutor',
    },
    localApi: {
      implemented: [
        'manual local setup for Greenwave gateway snapshots, raw data, snapshotProvider, and injected native clients',
        'runtime light entity mapping for gateway bulb snapshots',
        'safe light control delegation to injected client.execute or commandExecutor only',
      ],
      explicitUnsupported: [
        'native greenwavereality token pairing and bulb polling in this TypeScript package',
        'claiming live brightness or power command success without injected client.execute or commandExecutor',
        'Home Assistant filesystem token persistence for .greenwave',
      ],
    },
  },
};
