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

export const fireflyIiiDomain = 'firefly_iii';
export const fireflyIiiDefaultName = 'Firefly III';

export type TFireflyIiiRawData = TSimpleLocalRawData;
export interface IFireflyIiiSnapshot extends ISimpleLocalSnapshot {}
export interface IFireflyIiiConfig extends ISimpleLocalConfig {
  url?: string;
  apiKey?: string;
  verifySsl?: boolean;
}
export interface IHomeAssistantFireflyIiiConfig extends IFireflyIiiConfig {}

export const fireflyIiiProfile: ISimpleLocalIntegrationProfile = {
  domain: 'firefly_iii',
  displayName: 'Firefly III',
  manufacturer: 'Firefly III',
  model: 'Firefly III',
  defaultName: fireflyIiiDefaultName,
  status: 'read-only-runtime',
  platforms: [
    'sensor',
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'http',
    'custom',
  ],
  discoveryKeywords: [
    'firefly',
    'firefly iii',
    'finance',
    'budget',
    'pyfirefly',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/firefly_iii',
    upstreamDomain: 'firefly_iii',
    integrationType: 'service',
    iotClass: 'local_polling',
    qualityScale: 'bronze',
    qualityScaleRulesPath: 'homeassistant/components/firefly_iii/quality_scale.yaml',
    requirements: [
      'pyfirefly==0.1.12',
    ],
    dependencies: [],
    afterDependencies: [],
    codeowners: [
      '@erwindouna',
    ],
    configFlow: true,
    documentation: 'https://www.home-assistant.io/integrations/firefly_iii',
    homeAssistantPlatforms: [
      'sensor',
    ],
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
      ],
      platforms: [
        'sensor',
      ],
      controls: false,
    },
    localApi: {
      implemented: [
        'manual local setup for Firefly III URL, API key, snapshots, raw data, snapshotProvider, and injected native clients',
        'generic HTTP local transport when config.path points at a Firefly III JSON endpoint',
      ],
      explicitUnsupported: [
        'claiming live command success without injected client.execute or commandExecutor',
        'direct pyfirefly polling when no local path, injected client, snapshotProvider, snapshot, entities, or rawData is supplied',
        'Firefly III write operations and account administration',
      ],
    },
  },
};
