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

/**
 * ScheduleOverrideStore - IndexedDB ObjectStore for schedule overrides
 *
 * Stores date-specific schedule overrides for resources.
 * Indexes: resourceId, date, compound (resourceId + date)
 */
export class ScheduleOverrideStore implements IStore {
  static readonly STORE_NAME = 'scheduleOverrides';
  readonly storeName = ScheduleOverrideStore.STORE_NAME;

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

    store.createIndex('resourceId', 'resourceId', { unique: false });
    store.createIndex('date', 'date', { unique: false });
    store.createIndex('resourceId_date', ['resourceId', 'date'], { unique: true });
    store.createIndex('syncStatus', 'syncStatus', { unique: false });
  }
}
