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

export const folderDomain = 'folder';
export const folderDefaultName = 'Folder';
export const folderDefaultFilter = '*';

export type TFolderRawData = TSimpleLocalRawData;
export interface IFolderSnapshot extends ISimpleLocalSnapshot {}
export interface IFolderConfig extends ISimpleLocalConfig {
  folder?: string;
  folderPath?: string;
  folder_path?: string;
  filter?: string;
}
export interface IHomeAssistantFolderConfig extends IFolderConfig {}

export const folderProfile: ISimpleLocalIntegrationProfile = {
  domain: 'folder',
  displayName: 'Folder',
  manufacturer: 'Home Assistant',
  model: 'Local Folder Sensor',
  defaultName: folderDefaultName,
  defaultProtocol: 'local',
  status: 'read-only-runtime',
  platforms: [
    'sensor',
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    'folder',
    'folder sensor',
    'local folder',
    'directory size',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/folder',
    upstreamDomain: 'folder',
    iotClass: 'local_polling',
    qualityScale: 'legacy',
    requirements: [],
    dependencies: [],
    afterDependencies: [],
    codeowners: [],
    configFlow: false,
    documentation: 'https://www.home-assistant.io/integrations/folder',
    defaults: {
      filter: folderDefaultFilter,
      scanIntervalMinutes: 1,
      unit: 'MB',
    },
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
      ],
      platforms: [
        'sensor',
      ],
      controls: false,
    },
    localApi: {
      implemented: [
        'manual local folder path setup, snapshots, raw data, snapshotProvider, and injected native clients',
        'read-only local folder size snapshots from config.folder, config.folderPath, or config.folder_path',
        'Home Assistant folder sensor size, bytes, number_of_files, filter, and file_list mapping',
      ],
      explicitUnsupported: [
        'Home Assistant allowlist enforcement outside caller-provided safe local paths',
        'recursive glob semantics beyond simple local fixture-style wildcard filters',
        'claiming live command success without injected client.execute or commandExecutor',
      ],
    },
  },
};
