// Message type + target constants. Single source of truth — popup,
// service worker, and offscreen document all import from here so we
// can't drift on string typos.

export const TARGETS = Object.freeze({
  SW:        'sw',
  OFFSCREEN: 'offscreen',
  POPUP:     'popup',
});

export const TYPES = Object.freeze({
  PLAY:               'PLAY',
  PAUSE:              'PAUSE',
  SET_VOLUME:         'SET_VOLUME',
  GET_STATE:          'GET_STATE',
  STATE_CHANGED:      'STATE_CHANGED',
  METADATA_UPDATED:   'METADATA_UPDATED',
  LOG_TRACK_REQUEST:  'LOG_TRACK_REQUEST', // offscreen → SW: please write this entry to tuner.history
  TRACK_LOGGED:       'TRACK_LOGGED',      // SW → UI: a new entry was appended to tuner.history
  FAVOURITE_TOGGLED:  'FAVOURITE_TOGGLED', // UI → UI: re-render any visible fav lists
  STORAGE_WIPED:      'STORAGE_WIPED',     // options → UI: catastrophic reset, re-init from defaults
  ERROR:              'ERROR',
});
