import { Database } from '@nozbe/watermelondb';
import { adapter } from './adapter';
import Category from '../models/Category';
import Task from '../models/Task';
import Subtask from '../models/Subtask';
import RepeatProfile from '../models/RepeatProfile';
import Friendship from '../models/Friendship';
import Tombstone from '../models/Tombstone';

export const database = new Database({
  adapter,
  modelClasses: [Category, Task, Subtask, RepeatProfile, Friendship, Tombstone],
});

export const collections = {
  categories: database.collections.get<Category>('categories'),
  tasks: database.collections.get<Task>('tasks'),
  subtasks: database.collections.get<Subtask>('subtasks'),
  repeatProfiles: database.collections.get<RepeatProfile>('repeat_profiles'),
  friendships: database.collections.get<Friendship>('friendships'),
  tombstones: database.collections.get<Tombstone>('tombstones'),
};
