import 'package:habo/model/habo_model.dart';
import 'package:habo/repositories/habit_repository.dart';
import 'package:habo/repositories/event_repository.dart';
import 'package:habo/repositories/category_repository.dart';
import 'package:habo/repositories/sqlite_habit_repository.dart';
import 'package:habo/repositories/sqlite_event_repository.dart';
import 'package:habo/repositories/sqlite_category_repository.dart';

class RepositoryFactory {
  final HaboModel _model;

  HabitRepository? _habitRepository;
  EventRepository? _eventRepository;
  CategoryRepository? _categoryRepository;

  RepositoryFactory(this._model);

  HabitRepository get habitRepository {
    _habitRepository ??= SqliteHabitRepository(_model);
    return _habitRepository!;
  }

  EventRepository get eventRepository {
    _eventRepository ??= SqliteEventRepository(_model);
    return _eventRepository!;
  }

  CategoryRepository get categoryRepository {
    _categoryRepository ??= SqliteCategoryRepository(_model);
    return _categoryRepository!;
  }
}
