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

export const gtfsDomain = 'gtfs';
export const gtfsDefaultName = 'GTFS Sensor';
export const gtfsDefaultPath = 'gtfs';

export type TGtfsRawData = TSimpleLocalRawData;
export interface IGtfsSnapshot extends ISimpleLocalSnapshot {}
export interface IGtfsConfig extends ISimpleLocalConfig {
  data?: string;
  destination?: string;
  includeTomorrow?: boolean;
  offset?: number | string;
  origin?: string;
}
export interface IHomeAssistantGtfsConfig extends IGtfsConfig {}

export const gtfsProfile: ISimpleLocalIntegrationProfile = {
  domain: 'gtfs',
  displayName: 'General Transit Feed Specification (GTFS)',
  manufacturer: 'GTFS',
  model: 'Transit schedule feed',
  defaultName: gtfsDefaultName,
  defaultProtocol: 'local',
  status: 'read-only-runtime',
  platforms: [
    'sensor',
  ],
  serviceDomains: [
    'sensor',
  ],
  controlServices: [],
  discoverySources: [
    'manual',
    'custom',
  ],
  discoveryKeywords: [
    'gtfs',
    'general transit feed specification',
    'transit',
    'departure',
    'schedule',
  ],
  metadata: {
    source: 'home-assistant/core',
    upstreamPath: 'homeassistant/components/gtfs',
    upstreamDomain: 'gtfs',
    iotClass: 'local_polling',
    qualityScale: 'legacy',
    requirements: [
      'pygtfs==0.1.9',
    ],
    dependencies: [],
    afterDependencies: [],
    codeowners: [],
    configFlow: false,
    documentation: 'https://www.home-assistant.io/integrations/gtfs',
    loggers: [
      'pygtfs',
    ],
    homeAssistantPlatforms: [
      'sensor',
    ],
    defaults: {
      name: gtfsDefaultName,
      path: gtfsDefaultPath,
      includeTomorrow: false,
      offsetMinutes: 0,
    },
    runtime: {
      type: 'read-only-runtime',
      services: [
        'snapshot',
        'status',
        'refresh',
      ],
      platforms: [
        'sensor',
      ],
      controls: false,
    },
    localApi: {
      implemented: [
        'manual local setup for GTFS route metadata, snapshots, raw data, snapshotProvider, and injected native clients',
        'runtime timestamp sensor mapping for next-departure snapshots',
      ],
      explicitUnsupported: [
        'native pygtfs schedule import, sqlite creation, and SQL next-departure queries in this TypeScript package',
        'claiming live command success without injected client.execute or commandExecutor',
        'Home Assistant filesystem management for the gtfs data directory',
      ],
    },
  },
};
