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

export const localFileDomain = "local_file";
export const localFileDefaultName = "Local File";

export type TLocalFileRawData = TSimpleLocalRawData;
export interface ILocalFileSnapshot extends ISimpleLocalSnapshot {}
export interface ILocalFileConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
  filePath?: string;
  file_path?: string;
}

export const localFileProfile: ISimpleLocalIntegrationProfile = {
  domain: localFileDomain,
  displayName: "Local File",
  manufacturer: "Local File",
  model: "Local File local integration",
  defaultName: localFileDefaultName,
  defaultProtocol: 'local',
  status: "control-runtime",
  platforms: [
    "sensor",
  ],
  serviceDomains: [],
  controlServices: [
    "update_file_path",
  ],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "local_file",
    "Local File",
    "Local",
    "File",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/local_file",
    "upstreamDomain": "local_file",
    "iotClass": "local_polling",
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/local_file",
    "runtime": {
      "type": "control-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
        "update_file_path",
      ],
      "platforms": [
        "sensor",
      ],
      "controls": "native update_file_path; other controls delegated only to an injected client.execute or commandExecutor",
    },
    "localApi": {
      "implemented": [
        "local camera image snapshots from config.filePath or config.file_path using the same readable-file path as Home Assistant local_file",
        "native update_file_path service validation with fs access checks and in-runtime path switching",
        "manual snapshots, rawData, snapshotProvider, and injected native clients",
      ],
      "explicitUnsupported": [
        "Home Assistant camera streaming/resizing/auth proxy behavior; the native runtime reads the current image bytes only",
        "Home Assistant entity registry migrations and repair flows",
        "non-update_file_path command success without injected client.execute or commandExecutor",
      ],
    },
  },
};
