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

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

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

    store.createIndex('customerId', 'customerId', { unique: false });
    store.createIndex('status', 'status', { unique: false });
    store.createIndex('syncStatus', 'syncStatus', { unique: false });
    store.createIndex('createdAt', 'createdAt', { unique: false });
  }
}
