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

export const localTodoDomain = "local_todo";
export const localTodoDefaultName = "Local To-do";

export type TLocalTodoRawData = TSimpleLocalRawData;
export interface ILocalTodoSnapshot extends ISimpleLocalSnapshot {}
export interface ILocalTodoConfig extends ISimpleLocalConfig {
  url?: string;
  macAddress?: string;
  deviceId?: string;
  filePath?: string;
  icsPath?: string;
  storagePath?: string;
  todoFilePath?: string;
  todoListName?: string;
}
export interface IHomeAssistantLocalTodoConfig extends ILocalTodoConfig {}

export const localTodoProfile: ISimpleLocalIntegrationProfile = {
  domain: localTodoDomain,
  displayName: "Local To-do",
  manufacturer: "Local To-do",
  model: "Local To-do local integration",
  defaultName: localTodoDefaultName,
  defaultProtocol: 'local',
  status: "read-only-runtime",
  platforms: [
    "sensor",
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    "local_todo",
    "Local To-do",
    "Local Todo",
    "Local",
    "To-do",
  ],
  metadata: {
    "source": "home-assistant/core",
    "upstreamPath": "homeassistant/components/local_todo",
    "upstreamDomain": "local_todo",
    "iotClass": "local_polling",
    "requirements": [
      "ical==13.2.2",
    ],
    "codeowners": [
      "@allenporter",
    ],
    "configFlow": true,
    "documentation": "https://www.home-assistant.io/integrations/local_todo",
    "runtime": {
      "type": "read-only-runtime",
      "services": [
        "snapshot",
        "status",
        "refresh",
      ],
      "platforms": [
        "todo",
      ],
      "controls": false,
    },
    "localApi": {
      "implemented": [
        "manual local setup for Local To-do snapshots, rawData, snapshotProvider, injected native clients, and local ICS file paths",
        "read-only native local ICS file snapshots from config.filePath, config.icsPath, config.storagePath, config.todoFilePath, or local config.path",
        "runtime mapping for Local To-do device snapshots and Home Assistant platform metadata",
        "safe command delegation to injected client.execute or commandExecutor only",
      ],
      "explicitUnsupported": [
        "Home Assistant todo platform write operations because this runtime has no todo entity platform or native iCalendar writer dependency",
        "Home Assistant entity registry migrations and repair flows",
        "claiming command success without injected client.execute or commandExecutor",
      ],
    },
  },
};
