import { AnnotationsSorter } from 'src/sidebar/annotations-sidebar/sorting'

type Note = any
type Page = any
type NoteType = 'search' | 'user' | 'followed'

interface NewNoteFormState {
    inputValue: string
    // TODO: work out these states (may re-use from sidebar state)
}

interface NoteState {
    id: string
    // TODO: work out individual note states
}

interface PageState {
    id: string
    noteType: NoteType
    areNotesShown: boolean
    sortingFn: AnnotationsSorter
    newNoteForm: NewNoteFormState
    notes: { [name in NoteType]: NoteState[] }
}

interface ResultsByDay {
    date: Date
    pages: PageState[]
}

export interface RootState {
    results: ResultsByDay[]
    areAllNotesShown: boolean
    searchType: 'pages' | 'notes'
    pagesLookup: { [id: string]: Page }
    notesLookup: { [id: string]: Note }
}

Write first attempt at results state shape
Write first attempt at results state shape

- more complicated than it seems, mainly due to the doubly nested nature of the groupings (days -> pages -> notes)
- main differences from old:
  - regardless of search type, the state shape will be the same (in the case of page search, it will always have a single entry at the "days" grouping level)
  - keeping actual page and note data in separate lookup keys - I think having these inside the actual doubly nested results structure was one of the most complicated parts of the old state
