import { IStore } from '../IStore';

/**
 * ResourceStore - IndexedDB ObjectStore definition for resources
 */
export class ResourceStore implements IStore {
  static readonly STORE_NAME = 'resources';
  readonly storeName = ResourceStore.STORE_NAME;

  create(db: IDBDatabase): void {
    const store = db.createObjectStore(ResourceStore.STORE_NAME, { keyPath: 'id' });

    store.createIndex('type', 'type', { unique: false });
    store.createIndex('syncStatus', 'syncStatus', { unique: false });
    store.createIndex('isActive', 'isActive', { unique: false });
  }
}
