from collections import namedtuple
from enum import Enum, StrEnum
from typing import Literal, TypedDict

LogFormats = Literal["plaintext", "json"]
LogLevels = Literal["DEBUG", "INFO", "WARNING", "ERROR"]


class TNotProvided(Enum):
    token = 0


NOT_PROVIDED = TNotProvided.token


class FlashMessageType(StrEnum):
    DEPENDENCY_ORDER_ERROR = "dependency_order_error"
    SECTION_DEPENDENCY_ORDER_ERROR = "section_dependency_order_error"
    SECTION_COMPONENT_DEPENDENCY_ERROR = "section_component_dependency_error"
    DATA_SOURCE_ITEM_DEPENDENCY_ERROR = "data_source_item_dependency_error"
    DATA_SOURCE_REFERENCE_ERROR = "data_source_reference_error"
    DATA_SOURCE_REPLACED_SUCCESS = "data_source_replaced_success"
    DATA_SOURCE_UPLOADED_SUCCESS = "data_source_uploaded_success"
    DATA_SOURCE_DELETED = "data_source_deleted"
    SUBMISSION_TESTING_COMPLETE = "submission_testing_complete"
    QUESTION_CREATED = "question_created"
    NESTED_GROUP_ERROR = "nested_group_error"
    GROUP_VALIDATION_NOT_AVAILABLE = "group_validation_not_available"
    SUBMISSION_SIGN_OFF_DECLINED = "submission_sign_off_declined"
    TESTING_GRANT_RECIPIENT_JOURNEY_STARTED = "testing_grant_recipient_journey_started"
    TEST_SUBMISSION_RESET = "test_submission_reset"
    TEST_SUBMISSIONS_RESET = "test_submissions_reset"
    SUBMISSION_VALIDATION_ERROR = "submission_validation_error"
    SUBMISSION_REOPENED = "submission_reopened"
    SUBMISSION_CHANGES_REQUESTED = "submission_changes_requested"
    SUBMISSION_MARKED_AS_APPROVED = "submission_marked_as_approved"
    SUBMISSION_MARKED_AS_REJECTED = "submission_marked_as_rejected"
    COLLECTION_CREATED = "collection_created"


class TRadioItem(TypedDict):
    key: str
    label: str


ResolvedEndpoint = namedtuple("ResolvedEndpoint", ["name", "kwargs"])
