# SPDX-FileCopyrightText: Chris Pressey, the original author of this work, has dedicated it to the public domain.
# For more information, please refer to <https://unlicense.org/>
# SPDX-License-Identifier: Unlicense


from typing import Callable, TypeAlias, TypedDict


# should really be a part of Feedmark I think
class SectionJSON(TypedDict):
    anchor: str
    body: str
    images: list[str]
    properties: dict[str, str | list[str]]
    title: str


class ResourceCollection(TypedDict):
    webpages: list[SectionJSON]
    repos: list[SectionJSON]
    books: list[SectionJSON]
    papers: list[SectionJSON]


Entry: TypeAlias = SectionJSON
Topic: TypeAlias = str
TopicIndex: TypeAlias = dict[Topic, list[Entry]]
MultiLevelIndex: TypeAlias = dict[str, TopicIndex]
EntryFormatter: TypeAlias = Callable[[Entry], str]


class ResourceTopicIndex(TypedDict):
    webpages: TopicIndex
    repos: TopicIndex
    books: TopicIndex
    papers: TopicIndex
