from enum import Enum
from typing import Dict


class ResponseCode(Enum):
    """Response status-code enum."""

    SUCCESS = (200, "Operation succeeded")
    FAIL = (1, "Operation failed")
    SYSTEM_DATA_FAIL = (2, "Invalid data operation format")
    SYSTEM_PARAM_FAIL = (3, "Invalid parameter")
    AUTHORIZATION_EXCEPTION = (401, "Authorization error")

    def __init__(self, code: int, msg: str):
        self._code = code
        self._msg = msg

    @property
    def code(self) -> int:
        return self._code

    @property
    def msg(self) -> str:
        return self._msg

    @classmethod
    def get_all_as_dict(cls) -> Dict[int, str]:
        """Return all response codes and messages as a dictionary."""

        return {member.code: member.msg for member in cls}
