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

export const hitronCodaDomain = 'hitron_coda';
export const hitronCodaDefaultName = 'Rogers Hitron CODA';

export type THitronCodaRawData = TSimpleLocalRawData;
export interface IHitronCodaSnapshot extends ISimpleLocalSnapshot {}
export interface IHitronCodaConfig extends ISimpleLocalConfig {
  routerType?: string;
  type?: string;
}
export interface IHomeAssistantHitronCodaConfig extends IHitronCodaConfig {}

export const hitronCodaProfile: ISimpleLocalIntegrationProfile = {
  domain: 'hitron_coda',
  displayName: 'Rogers Hitron CODA',
  manufacturer: 'Hitron',
  model: 'CODA',
  defaultName: hitronCodaDefaultName,
  defaultProtocol: 'http',
  status: 'read-only-runtime',
  platforms: [
    'binary_sensor',
    'sensor',
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    'hitron',
    'coda',
    'coda-4582u',
    'rogers',
    'shaw',
    'router',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/hitron_coda',
    upstreamDomain: 'hitron_coda',
    iotClass: 'local_polling',
    qualityScale: 'legacy',
    requirements: [],
    dependencies: [],
    afterDependencies: [],
    codeowners: [],
    configFlow: false,
    documentation: 'https://www.home-assistant.io/integrations/hitron_coda',
    platforms: [
      'device_tracker',
    ],
    localEndpoints: {
      loginPath: '/goform/login',
      clientsPath: '/data/getConnectInfo.asp',
      authCookie: 'userid',
      passwordFieldByType: {
        rogers: 'pws',
        shaw: 'pwd',
      },
    },
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
      ],
      platforms: [
        'device_tracker',
      ],
      controls: false,
    },
    localApi: {
      implemented: [
        'manual local setup for router metadata, snapshots, raw getConnectInfo data, snapshotProvider, and injected native clients',
        'runtime mapping of Hitron connected clients to presence entities and connected-device counts',
      ],
      explicitUnsupported: [
        'native Hitron form login and userid cookie session flow in this TypeScript package',
        'claiming router-side changes or device-tracker updates without an injected client.execute or commandExecutor',
        'Home Assistant YAML device_tracker platform setup',
      ],
    },
  },
};
