import { Member, MusicPlayer } from '../types/state'; import { ActionErrorOccurred } from './error'; import { ActionLocal, ActionRemote, ActionTypeLocal, ActionTypeRemote } from './types'; export * from './types'; export type ActionStateSetRemote = ActionRemote; export type ActionClientListUpdated = ActionRemote; export type RemoteAction = ActionStateSetRemote | ActionClientListUpdated; export type LoggedOut = ActionLocal; export const loggedOut = (): LoggedOut => ({ type: ActionTypeLocal.LoggedOut, payload: undefined }); export type ActionNameSet = ActionLocal; export const nameSet = (name: string): ActionNameSet => ({ type: ActionTypeLocal.NameSet, payload: name, }); export type ActionStateSetLocal = ActionLocal< ActionTypeLocal.StateSet, Omit, 'seekTime'> >; export const stateSet = (state: Partial = {}): ActionStateSetLocal => ({ type: ActionTypeLocal.StateSet, payload: state, }); export type ActionSeeked = ActionLocal; export const seeked = (time: number): ActionSeeked => ({ type: ActionTypeLocal.Seeked, payload: time, }); export type ActionMasterRetaken = ActionLocal; export const masterRetaken = (): ActionMasterRetaken => ({ type: ActionTypeLocal.MasterRetaken, payload: undefined, }); export type ActionPlayPaused = ActionLocal; export const playPaused = (): ActionPlayPaused => ({ type: ActionTypeLocal.PlayPaused, payload: undefined, }); export type LocalAction = | LoggedOut | ActionErrorOccurred | ActionNameSet | ActionStateSetLocal | ActionSeeked | ActionPlayPaused | ActionMasterRetaken; export type AnyAction = LocalAction | RemoteAction;