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

export const fail2banDomain = 'fail2ban';
export const fail2banDefaultName = 'fail2ban';

export type TFail2banRawData = TSimpleLocalRawData;
export interface IFail2banSnapshot extends ISimpleLocalSnapshot {}
export interface IFail2banConfig extends ISimpleLocalConfig {
  filePath?: string;
  jails?: string[];
}
export interface IHomeAssistantFail2banConfig extends IFail2banConfig {}

export const fail2banProfile: ISimpleLocalIntegrationProfile = {
  domain: 'fail2ban',
  displayName: 'Fail2Ban',
  model: 'Fail2Ban log parser',
  defaultName: fail2banDefaultName,
  defaultProtocol: 'local',
  status: 'read-only-runtime',
  platforms: [
    'sensor',
  ],
  serviceDomains: [],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    'fail2ban',
    'ban',
    'jail',
    'firewall',
    'log',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/fail2ban',
    upstreamDomain: 'fail2ban',
    iotClass: 'local_polling',
    qualityScale: 'legacy',
    requirements: [],
    dependencies: [],
    afterDependencies: [],
    codeowners: [],
    configFlow: false,
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
      ],
      platforms: [
        'sensor',
      ],
      controls: false,
    },
    localApi: {
      implemented: [
        'manual local Fail2Ban jail snapshot setup',
        'snapshot, raw data, rawText, snapshotProvider, and injected native client operation',
      ],
      explicitUnsupported: [
        'claiming live command success without injected client.execute or commandExecutor',
        'reading arbitrary host log files unless provided through rawText, snapshotProvider, or an injected client',
        'mutating Fail2Ban jail state or firewall rules',
      ],
    },
  },
};
