import 'package:terepi_seged/services/app_database.dart';
import '../models/track.dart';

/// SQLite adatbázis-réteg a nyomvonalakhoz.
/// Singleton — [TrackDatabase.instance]-on keresztül érhető el.
class TrackDatabase {
  TrackDatabase._();
  static final instance = TrackDatabase._();

  // Minden hívás az AppDatabase-re delegál
  Future<int> insertTrack(Track t) => AppDatabase.instance.insertTrack(t);
  Future<void> updateTrack(Track t) => AppDatabase.instance.updateTrack(t);
  Future<void> deleteTrack(int id) => AppDatabase.instance.deleteTrack(id);
  Future<List<Track>> listTracks() => AppDatabase.instance.listTracks();
  Future<Track?> getTrack(int id) => AppDatabase.instance.getTrack(id);
  Future<void> addPoint(TrackPoint p, double d) =>
      AppDatabase.instance.addPoint(p, d);
  Future<List<TrackPoint>> getPoints(int id) =>
      AppDatabase.instance.getPoints(id);
  Future<List<({double lat, double lon})>> getLatLons(int trackId) =>
      AppDatabase.instance.getLatLons(trackId);
}
