from dataclasses import dataclass
from functools import wraps

from rest_framework.exceptions import PermissionDenied


@dataclass
class PERMISSIONS:
    CAN_VIEW_AGENT_DASHBOARD = "can_view_agent_dashboard"

    # user viewset
    CAN_INVITE_USER = "can_invite_user"
    CAN_VIEW_USERS_LIST = "can_view_users_list"
    CAN_VIEW_USER = "can_view_user"
    CAN_UPDATE_USER = "can_update_user"
    CAN_DELETE_USER = "can_delete_user"
    CAN_RE_INVITE_USER = "can_re_invite_user"
    CAN_UPDATE_USER_STATUS = "can_update_user_status"
    CAN_VIEW_DASHBOARD = "can_view_dashboard"

    # teams
    CAN_INVITE_TEAM_USER = "can_invite_team_user"
    CAN_VIEW_TEAMS_LIST = "can_view_teams_list"
    CAN_VIEW_TEAM = "can_view_team"
    CAN_UPDATE_TEAM = "can_update_team"
    CAN_RETRIEVE_DIRECT_REPORT = "can_retrieve_direct_report"
    CAN_DISABLE_TEAM_MEMBER = "can_disable_team_member"
    CAN_RETRIEVE_FUNCTIONAL_DIRECT_REPORTS_STATS = "can_retrieve_functional_direct_reports_stats"
    CAN_REACTIVE_TEAM = "can_reactive_team"
    CAN_VIEW_TEAM_STATS = "can_view_team_stats"

    # agent
    CAN_BLOCK_AGENT = "can_block_agent"
    CAN_VIEW_AGENT_LIST = "can_view_agent_list"
    CAN_CREATE_AGENT = "can_create_agent"

    # wallet settings
    CAN_CREATE_TERMINAL_PROFILE = "can_create_terminal_profile"
    CAN_EDIT_TERMINAL_PROFILE = "can_edit_terminal_profile"
    CAN_VIEW_TERMINAL_PROFILE = "can_view_terminal_profile"
    CAN_VIEW_TERMINAL_PROFILE_LIST = "can_view_terminal_profile_list"
    CAN_DELETE_TERMINAL_PROFILE = "can_delete_terminal_profile"

    CAN_CREATE_VAS_FEE = "can_create_vas_fee"
    CAN_VIEW_VAS_FEE = "can_view_vas_fee"
    CAN_EDIT_VAS_FEE = "can_edit_vas_fee"

    CAN_MANAGE_SETTLEMENT_BANK = "can_manage_settlement_bank"
    CAN_VIEW_SETTLEMENT_BANK = "can_view_settlement_bank"
    CAN_MANAGE_NIBBS_BANK = "can_manage_nibbs_bank"
    CAN_VIEW_NIBBS_BANK = "can_view_nibbs_bank"
    CAN_MANAGE_BANKS = "can_manage_banks"
    CAN_VIEW_BANKS = "can_view_banks"

    CAN_MANAGE_WEMA_COLLECTION = "can_manage_wema_collection"
    CAN_VIEW_WEMA_COLLECTION = "can_view_wema_collection"

    CAN_MANAGE_WITHDRAWAL_ROUTING = "can_manage_withdrawal_routing"
    CAN_VIEW_WITHDRAWAL_ROUTING = "can_view_withdrawal_routing"
    CAN_MANAGE_VAS_SETTINGS = "can_manage_vas_settings"
    CAN_VIEW_VAS_SETTINGS = "can_view_vas_settings"
    CAN_MANAGE_TRANSFER_PROVIDER_SETTINGS = "can_manage_transfer_provider_settings"
    CAN_VIEW_TRANSFER_PROVIDER_SETTINGS = "can_view_transfer_provider_settings"

    # transactions
    CAN_VIEW_TRANSACTION = "can_view_transaction"
    CAN_REVERSE_TRANSACTION = "can_reverse_transaction"
    CAN_BULK_REVERSE_TRANSACTION = "can_bulk_reverse_transaction"
    CAN_INITIATE_TRANSFER = "can_initiate_transfer"
    CAN_INITIATE_VAS = "can_initiate_vas"
    CAN_INITIATE_CASHOUT = "can_initiate_cashout"
    CAN_INITIATE_PRODUCT = "can_initiate_product"
    CAN_INITIATE_COMMISSION_PAYOUT = "can_initiate_commission_payout"
    CAN_DEBIT_CREDIT_TERMINAL = "can_debit_credit_terminal"
    CAN_FINALISE_TRANSACTION = "can_finalise_transaction"
    CAN_GET_TRANSACTION_STATS = "can_get_transaction_stats"
    CAN_SEND_STATEMENT = "can_send_statement"
    CAN_DOWNLOAD_STATEMENT = "can_download_statement"
    CAN_VIEW_SUCCESS_RATES = "can_view_success_rates"
    CAN_PAY_FOR_TERMINAL = "can_pay_for_terminal"

    # wallet
    CAN_CREATE_WALLET = "can_create_wallet"
    CAN_VIEW_WALLET = "can_view_wallet"
    CAN_VIEW_WALLET_LIST = "can_view_wallet_list"
    CAN_UPDATE_WALLET = "can_update_wallet"
    CAN_CREATE_TRANSACTION_PIN = "can_create_transaction_pin"
    CAN_UPDATE_WALLET_KYC_LEVEL = "can_update_wallet_kyc_level"
    CAN_RETRIEVE_TERMINAL = "can_retrieve_terminal"
    CAN_REPLACE_TERMINAL = "can_replace_terminal"
    CAN_UPDATE_WALLET_TERMINAL_PROFILE = "can_update_wallet_terminal_profile"
    CAN_BULK_UPDATE_WALLET_TERMINAL_PROFILE = "can_bulk_update_wallet_terminal_profile"
    CAN_BLOCK_UNBLOCK_TERMINAL = "can_block_unblock_terminal"
    CAN_BLOCK_UNBLOCK_USER = "can_block_unblock_user"
    CAN_GET_WALLET_STATS = "can_get_wallet_stats"
    CAN_GET_COMMISSION_STATS = "can_get_commission_stats"

    # terminal
    CAN_GET_TERMINAL_STATS = "can_get_terminal_stats"
    CAN_GET_TERMINAL_DETAILS = "can_get_terminal_details"
    CAN_GET_TERMINAL_WALLET_TERMINAL_LIST = "can_get_terminal_wallet_terminal_list"


ROLE_PERMISSIONS = {

    "Super Admin": [
        PERMISSIONS.CAN_INVITE_USER,
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_INVITE_USER,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_UPDATE_USER,
        PERMISSIONS.CAN_RE_INVITE_USER,
        PERMISSIONS.CAN_UPDATE_USER_STATUS,
        PERMISSIONS.CAN_VIEW_DASHBOARD,

        PERMISSIONS.CAN_INVITE_TEAM_USER,
        PERMISSIONS.CAN_VIEW_TEAMS_LIST,
        PERMISSIONS.CAN_VIEW_TEAM,
        PERMISSIONS.CAN_UPDATE_TEAM,
        PERMISSIONS.CAN_RETRIEVE_DIRECT_REPORT,
        PERMISSIONS.CAN_DISABLE_TEAM_MEMBER,
        PERMISSIONS.CAN_RETRIEVE_FUNCTIONAL_DIRECT_REPORTS_STATS,
        PERMISSIONS.CAN_REACTIVE_TEAM,
        PERMISSIONS.CAN_VIEW_TEAM_STATS,

        PERMISSIONS.CAN_BLOCK_AGENT,
        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_CREATE_AGENT,

        PERMISSIONS.CAN_CREATE_TERMINAL_PROFILE,
        PERMISSIONS.CAN_EDIT_TERMINAL_PROFILE,
        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE,
        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE_LIST,
        PERMISSIONS.CAN_DELETE_TERMINAL_PROFILE,

        PERMISSIONS.CAN_CREATE_VAS_FEE,
        PERMISSIONS.CAN_VIEW_VAS_FEE,
        PERMISSIONS.CAN_EDIT_VAS_FEE,

        PERMISSIONS.CAN_MANAGE_SETTLEMENT_BANK,
        PERMISSIONS.CAN_MANAGE_NIBBS_BANK,
        PERMISSIONS.CAN_MANAGE_BANKS,

        PERMISSIONS.CAN_MANAGE_WEMA_COLLECTION,

        PERMISSIONS.CAN_MANAGE_WITHDRAWAL_ROUTING,
        PERMISSIONS.CAN_VIEW_WITHDRAWAL_ROUTING,
        PERMISSIONS.CAN_MANAGE_VAS_SETTINGS,
        PERMISSIONS.CAN_VIEW_VAS_SETTINGS,
        PERMISSIONS.CAN_MANAGE_TRANSFER_PROVIDER_SETTINGS,
        PERMISSIONS.CAN_VIEW_TRANSFER_PROVIDER_SETTINGS,

        # transactions
        PERMISSIONS.CAN_VIEW_TRANSACTION,
        PERMISSIONS.CAN_REVERSE_TRANSACTION,
        PERMISSIONS.CAN_BULK_REVERSE_TRANSACTION,
        PERMISSIONS.CAN_INITIATE_TRANSFER,
        PERMISSIONS.CAN_INITIATE_VAS,
        PERMISSIONS.CAN_INITIATE_CASHOUT,
        PERMISSIONS.CAN_INITIATE_PRODUCT,
        PERMISSIONS.CAN_INITIATE_COMMISSION_PAYOUT,
        PERMISSIONS.CAN_DEBIT_CREDIT_TERMINAL,
        PERMISSIONS.CAN_FINALISE_TRANSACTION,
        PERMISSIONS.CAN_GET_TRANSACTION_STATS,
        PERMISSIONS.CAN_SEND_STATEMENT,
        PERMISSIONS.CAN_DOWNLOAD_STATEMENT,
        PERMISSIONS.CAN_VIEW_SUCCESS_RATES,
        PERMISSIONS.CAN_PAY_FOR_TERMINAL,

        # wallet
        PERMISSIONS.CAN_CREATE_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET_LIST,
        PERMISSIONS.CAN_UPDATE_WALLET,
        PERMISSIONS.CAN_CREATE_TRANSACTION_PIN,
        PERMISSIONS.CAN_UPDATE_WALLET_KYC_LEVEL,
        PERMISSIONS.CAN_RETRIEVE_TERMINAL,
        PERMISSIONS.CAN_REPLACE_TERMINAL,
        PERMISSIONS.CAN_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BULK_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BLOCK_UNBLOCK_TERMINAL,
        PERMISSIONS.CAN_BLOCK_UNBLOCK_USER,
        PERMISSIONS.CAN_GET_WALLET_STATS,
        PERMISSIONS.CAN_GET_COMMISSION_STATS,

        # terminal
        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,

    ],
    "Admin": [
        PERMISSIONS.CAN_INVITE_USER,
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_INVITE_USER,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_UPDATE_USER,
        PERMISSIONS.CAN_RE_INVITE_USER,
        PERMISSIONS.CAN_UPDATE_USER_STATUS,
        PERMISSIONS.CAN_VIEW_DASHBOARD,

        PERMISSIONS.CAN_INVITE_TEAM_USER,
        PERMISSIONS.CAN_VIEW_TEAMS_LIST,
        PERMISSIONS.CAN_VIEW_TEAM,
        PERMISSIONS.CAN_UPDATE_TEAM,
        PERMISSIONS.CAN_RETRIEVE_DIRECT_REPORT,
        PERMISSIONS.CAN_DISABLE_TEAM_MEMBER,
        PERMISSIONS.CAN_RETRIEVE_FUNCTIONAL_DIRECT_REPORTS_STATS,
        PERMISSIONS.CAN_REACTIVE_TEAM,
        PERMISSIONS.CAN_VIEW_TEAM_STATS,

        PERMISSIONS.CAN_BLOCK_AGENT,
        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_CREATE_AGENT,

        PERMISSIONS.CAN_CREATE_TERMINAL_PROFILE,
        PERMISSIONS.CAN_EDIT_TERMINAL_PROFILE,
        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE,
        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE_LIST,
        PERMISSIONS.CAN_DELETE_TERMINAL_PROFILE,

        PERMISSIONS.CAN_CREATE_VAS_FEE,
        PERMISSIONS.CAN_VIEW_VAS_FEE,
        PERMISSIONS.CAN_EDIT_VAS_FEE,

        PERMISSIONS.CAN_MANAGE_SETTLEMENT_BANK,
        PERMISSIONS.CAN_MANAGE_NIBBS_BANK,
        PERMISSIONS.CAN_MANAGE_BANKS,

        PERMISSIONS.CAN_MANAGE_WEMA_COLLECTION,

        PERMISSIONS.CAN_MANAGE_WITHDRAWAL_ROUTING,
        PERMISSIONS.CAN_VIEW_WITHDRAWAL_ROUTING,
        PERMISSIONS.CAN_MANAGE_VAS_SETTINGS,
        PERMISSIONS.CAN_VIEW_VAS_SETTINGS,
        PERMISSIONS.CAN_MANAGE_TRANSFER_PROVIDER_SETTINGS,
        PERMISSIONS.CAN_VIEW_TRANSFER_PROVIDER_SETTINGS,

        # transactions
        PERMISSIONS.CAN_VIEW_TRANSACTION,
        PERMISSIONS.CAN_REVERSE_TRANSACTION,
        PERMISSIONS.CAN_BULK_REVERSE_TRANSACTION,
        PERMISSIONS.CAN_INITIATE_TRANSFER,
        PERMISSIONS.CAN_INITIATE_VAS,
        PERMISSIONS.CAN_INITIATE_CASHOUT,
        PERMISSIONS.CAN_INITIATE_PRODUCT,
        PERMISSIONS.CAN_INITIATE_COMMISSION_PAYOUT,
        PERMISSIONS.CAN_DEBIT_CREDIT_TERMINAL,
        PERMISSIONS.CAN_FINALISE_TRANSACTION,
        PERMISSIONS.CAN_GET_TRANSACTION_STATS,
        PERMISSIONS.CAN_SEND_STATEMENT,
        PERMISSIONS.CAN_DOWNLOAD_STATEMENT,
        PERMISSIONS.CAN_VIEW_SUCCESS_RATES,
        PERMISSIONS.CAN_PAY_FOR_TERMINAL,

        # wallet
        PERMISSIONS.CAN_CREATE_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET_LIST,
        PERMISSIONS.CAN_UPDATE_WALLET,
        PERMISSIONS.CAN_CREATE_TRANSACTION_PIN,
        PERMISSIONS.CAN_UPDATE_WALLET_KYC_LEVEL,
        PERMISSIONS.CAN_RETRIEVE_TERMINAL,
        PERMISSIONS.CAN_REPLACE_TERMINAL,
        PERMISSIONS.CAN_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BULK_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BLOCK_UNBLOCK_TERMINAL,
        PERMISSIONS.CAN_BLOCK_UNBLOCK_USER,
        PERMISSIONS.CAN_GET_WALLET_STATS,
        PERMISSIONS.CAN_GET_COMMISSION_STATS,

        # terminal
        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,
    ],
    "Head of Operations": [
        PERMISSIONS.CAN_INVITE_USER,
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_INVITE_USER,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_UPDATE_USER,
        PERMISSIONS.CAN_RE_INVITE_USER,
        PERMISSIONS.CAN_UPDATE_USER_STATUS,
        PERMISSIONS.CAN_VIEW_DASHBOARD,

        PERMISSIONS.CAN_INVITE_TEAM_USER,
        PERMISSIONS.CAN_VIEW_TEAMS_LIST,
        PERMISSIONS.CAN_VIEW_TEAM,
        PERMISSIONS.CAN_UPDATE_TEAM,
        PERMISSIONS.CAN_RETRIEVE_DIRECT_REPORT,
        PERMISSIONS.CAN_DISABLE_TEAM_MEMBER,
        PERMISSIONS.CAN_RETRIEVE_FUNCTIONAL_DIRECT_REPORTS_STATS,
        PERMISSIONS.CAN_REACTIVE_TEAM,
        PERMISSIONS.CAN_VIEW_TEAM_STATS,

        PERMISSIONS.CAN_BLOCK_AGENT,
        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_CREATE_AGENT,

        PERMISSIONS.CAN_CREATE_TERMINAL_PROFILE,
        PERMISSIONS.CAN_EDIT_TERMINAL_PROFILE,
        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE,
        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE_LIST,
        PERMISSIONS.CAN_DELETE_TERMINAL_PROFILE,

        PERMISSIONS.CAN_CREATE_VAS_FEE,
        PERMISSIONS.CAN_VIEW_VAS_FEE,
        PERMISSIONS.CAN_EDIT_VAS_FEE,

        PERMISSIONS.CAN_MANAGE_SETTLEMENT_BANK,
        PERMISSIONS.CAN_MANAGE_NIBBS_BANK,
        PERMISSIONS.CAN_MANAGE_BANKS,

        PERMISSIONS.CAN_MANAGE_WEMA_COLLECTION,

        PERMISSIONS.CAN_MANAGE_WITHDRAWAL_ROUTING,
        PERMISSIONS.CAN_VIEW_WITHDRAWAL_ROUTING,
        PERMISSIONS.CAN_MANAGE_VAS_SETTINGS,
        PERMISSIONS.CAN_VIEW_VAS_SETTINGS,
        PERMISSIONS.CAN_MANAGE_TRANSFER_PROVIDER_SETTINGS,
        PERMISSIONS.CAN_VIEW_TRANSFER_PROVIDER_SETTINGS,

        # transactions
        PERMISSIONS.CAN_VIEW_TRANSACTION,
        PERMISSIONS.CAN_REVERSE_TRANSACTION,
        PERMISSIONS.CAN_BULK_REVERSE_TRANSACTION,
        PERMISSIONS.CAN_INITIATE_TRANSFER,
        PERMISSIONS.CAN_INITIATE_VAS,
        PERMISSIONS.CAN_INITIATE_CASHOUT,
        PERMISSIONS.CAN_INITIATE_PRODUCT,
        PERMISSIONS.CAN_INITIATE_COMMISSION_PAYOUT,
        PERMISSIONS.CAN_DEBIT_CREDIT_TERMINAL,
        PERMISSIONS.CAN_FINALISE_TRANSACTION,
        PERMISSIONS.CAN_GET_TRANSACTION_STATS,
        PERMISSIONS.CAN_SEND_STATEMENT,
        PERMISSIONS.CAN_DOWNLOAD_STATEMENT,
        PERMISSIONS.CAN_VIEW_SUCCESS_RATES,
        PERMISSIONS.CAN_PAY_FOR_TERMINAL,

        # wallet
        PERMISSIONS.CAN_CREATE_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET_LIST,
        PERMISSIONS.CAN_UPDATE_WALLET,
        PERMISSIONS.CAN_CREATE_TRANSACTION_PIN,
        PERMISSIONS.CAN_UPDATE_WALLET_KYC_LEVEL,
        PERMISSIONS.CAN_RETRIEVE_TERMINAL,
        PERMISSIONS.CAN_REPLACE_TERMINAL,
        PERMISSIONS.CAN_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BULK_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BLOCK_UNBLOCK_TERMINAL,
        PERMISSIONS.CAN_BLOCK_UNBLOCK_USER,
        PERMISSIONS.CAN_GET_WALLET_STATS,
        PERMISSIONS.CAN_GET_COMMISSION_STATS,

        # terminal
        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,
    ],
    "Admin View Only": [
        PERMISSIONS.CAN_INVITE_USER,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_UPDATE_USER,
        PERMISSIONS.CAN_RE_INVITE_USER,
        PERMISSIONS.CAN_UPDATE_USER_STATUS,
        PERMISSIONS.CAN_VIEW_DASHBOARD,

        PERMISSIONS.CAN_INVITE_TEAM_USER,
        PERMISSIONS.CAN_VIEW_TEAMS_LIST,
        PERMISSIONS.CAN_VIEW_TEAM,
        PERMISSIONS.CAN_UPDATE_TEAM,
        PERMISSIONS.CAN_RETRIEVE_DIRECT_REPORT,
        PERMISSIONS.CAN_DISABLE_TEAM_MEMBER,
        PERMISSIONS.CAN_RETRIEVE_FUNCTIONAL_DIRECT_REPORTS_STATS,
        PERMISSIONS.CAN_REACTIVE_TEAM,
        PERMISSIONS.CAN_VIEW_TEAM_STATS,

        PERMISSIONS.CAN_BLOCK_AGENT,
        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_CREATE_AGENT,

        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE,
        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE_LIST,

        PERMISSIONS.CAN_VIEW_VAS_FEE,

        PERMISSIONS.CAN_VIEW_WITHDRAWAL_ROUTING,
        PERMISSIONS.CAN_VIEW_VAS_SETTINGS,
        PERMISSIONS.CAN_VIEW_TRANSFER_PROVIDER_SETTINGS,

        PERMISSIONS.CAN_MANAGE_WEMA_COLLECTION,

        PERMISSIONS.CAN_MANAGE_WITHDRAWAL_ROUTING,
        PERMISSIONS.CAN_MANAGE_VAS_SETTINGS,
        PERMISSIONS.CAN_MANAGE_TRANSFER_PROVIDER_SETTINGS,

        # transactions
        PERMISSIONS.CAN_VIEW_TRANSACTION,
        PERMISSIONS.CAN_GET_TRANSACTION_STATS,
        PERMISSIONS.CAN_VIEW_SUCCESS_RATES,

        # wallet
        PERMISSIONS.CAN_VIEW_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET_LIST,
        PERMISSIONS.CAN_GET_WALLET_STATS,
        PERMISSIONS.CAN_GET_COMMISSION_STATS,

        # terminal
        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,

    ],
    "Divisional Head": [
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_INVITE_USER,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_RE_INVITE_USER,
        PERMISSIONS.CAN_VIEW_DASHBOARD,

        PERMISSIONS.CAN_VIEW_TEAMS_LIST,
        PERMISSIONS.CAN_VIEW_TEAM,
        PERMISSIONS.CAN_RETRIEVE_DIRECT_REPORT,
        PERMISSIONS.CAN_RETRIEVE_FUNCTIONAL_DIRECT_REPORTS_STATS,
        PERMISSIONS.CAN_VIEW_TEAM_STATS,

        PERMISSIONS.CAN_BLOCK_AGENT,
        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_CREATE_AGENT,

        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE,
        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE_LIST,

        PERMISSIONS.CAN_VIEW_VAS_FEE,

        PERMISSIONS.CAN_VIEW_WITHDRAWAL_ROUTING,
        PERMISSIONS.CAN_VIEW_VAS_SETTINGS,
        PERMISSIONS.CAN_VIEW_TRANSFER_PROVIDER_SETTINGS,

        # transactions
        PERMISSIONS.CAN_VIEW_TRANSACTION,
        PERMISSIONS.CAN_GET_TRANSACTION_STATS,
        PERMISSIONS.CAN_SEND_STATEMENT,
        PERMISSIONS.CAN_DOWNLOAD_STATEMENT,
        PERMISSIONS.CAN_VIEW_SUCCESS_RATES,
        PERMISSIONS.CAN_PAY_FOR_TERMINAL,

        # wallet
        PERMISSIONS.CAN_CREATE_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET_LIST,
        PERMISSIONS.CAN_UPDATE_WALLET,
        PERMISSIONS.CAN_UPDATE_WALLET_KYC_LEVEL,
        PERMISSIONS.CAN_RETRIEVE_TERMINAL,
        PERMISSIONS.CAN_REPLACE_TERMINAL,
        PERMISSIONS.CAN_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BULK_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BLOCK_UNBLOCK_TERMINAL,
        PERMISSIONS.CAN_BLOCK_UNBLOCK_USER,
        PERMISSIONS.CAN_GET_WALLET_STATS,
        PERMISSIONS.CAN_GET_COMMISSION_STATS,

        # terminal
        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,
    ],
    "Agent Network Manager": [
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_VIEW_DASHBOARD,

        PERMISSIONS.CAN_BLOCK_AGENT,
        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_CREATE_AGENT,

        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE,
        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE_LIST,

        PERMISSIONS.CAN_VIEW_VAS_FEE,

        PERMISSIONS.CAN_VIEW_WITHDRAWAL_ROUTING,
        PERMISSIONS.CAN_VIEW_VAS_SETTINGS,
        PERMISSIONS.CAN_VIEW_TRANSFER_PROVIDER_SETTINGS,

        # transactions
        PERMISSIONS.CAN_VIEW_TRANSACTION,
        PERMISSIONS.CAN_GET_TRANSACTION_STATS,
        PERMISSIONS.CAN_SEND_STATEMENT,
        PERMISSIONS.CAN_DOWNLOAD_STATEMENT,
        PERMISSIONS.CAN_VIEW_SUCCESS_RATES,
        PERMISSIONS.CAN_PAY_FOR_TERMINAL,

        # wallet
        PERMISSIONS.CAN_CREATE_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET_LIST,
        PERMISSIONS.CAN_UPDATE_WALLET,
        PERMISSIONS.CAN_UPDATE_WALLET_KYC_LEVEL,
        PERMISSIONS.CAN_RETRIEVE_TERMINAL,
        PERMISSIONS.CAN_REPLACE_TERMINAL,
        PERMISSIONS.CAN_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BULK_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BLOCK_UNBLOCK_TERMINAL,
        PERMISSIONS.CAN_BLOCK_UNBLOCK_USER,
        PERMISSIONS.CAN_GET_WALLET_STATS,
        PERMISSIONS.CAN_GET_COMMISSION_STATS,

        # terminal
        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,

    ],
    "Regional Head": [
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_INVITE_USER,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_RE_INVITE_USER,
        PERMISSIONS.CAN_VIEW_DASHBOARD,

        PERMISSIONS.CAN_VIEW_TEAMS_LIST,
        PERMISSIONS.CAN_VIEW_TEAM,
        PERMISSIONS.CAN_RETRIEVE_DIRECT_REPORT,
        PERMISSIONS.CAN_RETRIEVE_FUNCTIONAL_DIRECT_REPORTS_STATS,
        PERMISSIONS.CAN_VIEW_TEAM_STATS,

        PERMISSIONS.CAN_BLOCK_AGENT,
        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_CREATE_AGENT,

        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE,
        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE_LIST,

        PERMISSIONS.CAN_VIEW_VAS_FEE,

        PERMISSIONS.CAN_VIEW_WITHDRAWAL_ROUTING,
        PERMISSIONS.CAN_VIEW_VAS_SETTINGS,
        PERMISSIONS.CAN_VIEW_TRANSFER_PROVIDER_SETTINGS,

        # transactions
        PERMISSIONS.CAN_VIEW_TRANSACTION,
        PERMISSIONS.CAN_GET_TRANSACTION_STATS,
        PERMISSIONS.CAN_SEND_STATEMENT,
        PERMISSIONS.CAN_DOWNLOAD_STATEMENT,
        PERMISSIONS.CAN_VIEW_SUCCESS_RATES,
        PERMISSIONS.CAN_PAY_FOR_TERMINAL,

        # wallet
        PERMISSIONS.CAN_CREATE_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET_LIST,
        PERMISSIONS.CAN_UPDATE_WALLET,
        PERMISSIONS.CAN_UPDATE_WALLET_KYC_LEVEL,
        PERMISSIONS.CAN_RETRIEVE_TERMINAL,
        PERMISSIONS.CAN_REPLACE_TERMINAL,
        PERMISSIONS.CAN_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BULK_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BLOCK_UNBLOCK_TERMINAL,
        PERMISSIONS.CAN_BLOCK_UNBLOCK_USER,
        PERMISSIONS.CAN_GET_WALLET_STATS,
        PERMISSIONS.CAN_GET_COMMISSION_STATS,

        # terminal
        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,

    ],
    "Relationship Officer": [
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_VIEW_DASHBOARD,

        PERMISSIONS.CAN_VIEW_TEAMS_LIST,
        PERMISSIONS.CAN_VIEW_TEAM,
        PERMISSIONS.CAN_RETRIEVE_DIRECT_REPORT,
        PERMISSIONS.CAN_RETRIEVE_FUNCTIONAL_DIRECT_REPORTS_STATS,
        PERMISSIONS.CAN_VIEW_TEAM_STATS,

        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_CREATE_AGENT,

        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE,
        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE_LIST,

        PERMISSIONS.CAN_VIEW_VAS_FEE,

        PERMISSIONS.CAN_VIEW_WITHDRAWAL_ROUTING,
        PERMISSIONS.CAN_VIEW_VAS_SETTINGS,
        PERMISSIONS.CAN_VIEW_TRANSFER_PROVIDER_SETTINGS,

        # transactions
        PERMISSIONS.CAN_VIEW_TRANSACTION,
        PERMISSIONS.CAN_GET_TRANSACTION_STATS,
        PERMISSIONS.CAN_SEND_STATEMENT,
        PERMISSIONS.CAN_DOWNLOAD_STATEMENT,
        PERMISSIONS.CAN_VIEW_SUCCESS_RATES,
        PERMISSIONS.CAN_PAY_FOR_TERMINAL,

        # wallet
        PERMISSIONS.CAN_CREATE_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET_LIST,
        PERMISSIONS.CAN_UPDATE_WALLET,
        PERMISSIONS.CAN_UPDATE_WALLET_KYC_LEVEL,
        PERMISSIONS.CAN_RETRIEVE_TERMINAL,
        PERMISSIONS.CAN_REPLACE_TERMINAL,
        PERMISSIONS.CAN_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BULK_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BLOCK_UNBLOCK_TERMINAL,
        PERMISSIONS.CAN_BLOCK_UNBLOCK_USER,
        PERMISSIONS.CAN_GET_WALLET_STATS,
        PERMISSIONS.CAN_GET_COMMISSION_STATS,

        # terminal
        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,

    ],
    "Merchant": [
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_UPDATE_USER,
        PERMISSIONS.CAN_VIEW_DASHBOARD,

        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_CREATE_AGENT,

        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE,
        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE_LIST,

        PERMISSIONS.CAN_VIEW_VAS_FEE,

        PERMISSIONS.CAN_VIEW_WITHDRAWAL_ROUTING,
        PERMISSIONS.CAN_VIEW_VAS_SETTINGS,
        PERMISSIONS.CAN_VIEW_TRANSFER_PROVIDER_SETTINGS,

        # transactions
        PERMISSIONS.CAN_VIEW_TRANSACTION,
        PERMISSIONS.CAN_INITIATE_TRANSFER,
        PERMISSIONS.CAN_INITIATE_VAS,
        PERMISSIONS.CAN_INITIATE_CASHOUT,
        PERMISSIONS.CAN_INITIATE_PRODUCT,
        PERMISSIONS.CAN_INITIATE_COMMISSION_PAYOUT,
        PERMISSIONS.CAN_FINALISE_TRANSACTION,
        PERMISSIONS.CAN_GET_TRANSACTION_STATS,
        PERMISSIONS.CAN_SEND_STATEMENT,
        PERMISSIONS.CAN_DOWNLOAD_STATEMENT,
        PERMISSIONS.CAN_VIEW_SUCCESS_RATES,
        PERMISSIONS.CAN_PAY_FOR_TERMINAL,

        # wallet
        PERMISSIONS.CAN_CREATE_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET_LIST,
        PERMISSIONS.CAN_UPDATE_WALLET,
        PERMISSIONS.CAN_CREATE_TRANSACTION_PIN,
        PERMISSIONS.CAN_UPDATE_WALLET_KYC_LEVEL,
        PERMISSIONS.CAN_RETRIEVE_TERMINAL,
        PERMISSIONS.CAN_REPLACE_TERMINAL,
        PERMISSIONS.CAN_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BULK_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_GET_WALLET_STATS,
        PERMISSIONS.CAN_GET_COMMISSION_STATS,

        # terminal
        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,

    ],
    "Super Agent": [
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_UPDATE_USER,
        PERMISSIONS.CAN_VIEW_DASHBOARD,

        PERMISSIONS.CAN_BLOCK_AGENT,
        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_CREATE_AGENT,

        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE,
        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE_LIST,

        PERMISSIONS.CAN_VIEW_VAS_FEE,

        PERMISSIONS.CAN_VIEW_WITHDRAWAL_ROUTING,
        PERMISSIONS.CAN_VIEW_VAS_SETTINGS,
        PERMISSIONS.CAN_VIEW_TRANSFER_PROVIDER_SETTINGS,

        # transactions
        PERMISSIONS.CAN_VIEW_TRANSACTION,
        PERMISSIONS.CAN_INITIATE_TRANSFER,
        PERMISSIONS.CAN_INITIATE_VAS,
        PERMISSIONS.CAN_INITIATE_CASHOUT,
        PERMISSIONS.CAN_INITIATE_PRODUCT,
        PERMISSIONS.CAN_INITIATE_COMMISSION_PAYOUT,
        PERMISSIONS.CAN_FINALISE_TRANSACTION,
        PERMISSIONS.CAN_GET_TRANSACTION_STATS,
        PERMISSIONS.CAN_SEND_STATEMENT,
        PERMISSIONS.CAN_DOWNLOAD_STATEMENT,
        PERMISSIONS.CAN_VIEW_SUCCESS_RATES,
        PERMISSIONS.CAN_PAY_FOR_TERMINAL,

        # wallet
        PERMISSIONS.CAN_CREATE_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET_LIST,
        PERMISSIONS.CAN_UPDATE_WALLET,
        PERMISSIONS.CAN_CREATE_TRANSACTION_PIN,
        PERMISSIONS.CAN_UPDATE_WALLET_KYC_LEVEL,
        PERMISSIONS.CAN_RETRIEVE_TERMINAL,
        PERMISSIONS.CAN_REPLACE_TERMINAL,
        PERMISSIONS.CAN_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BULK_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_GET_WALLET_STATS,
        PERMISSIONS.CAN_GET_COMMISSION_STATS,

        # terminal
        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,

    ],
    "Agent": [
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_VIEW_USERS_LIST,
        PERMISSIONS.CAN_UPDATE_USER,
        PERMISSIONS.CAN_VIEW_DASHBOARD,

        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_CREATE_AGENT,

        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE,
        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE_LIST,

        PERMISSIONS.CAN_VIEW_VAS_FEE,

        PERMISSIONS.CAN_VIEW_WITHDRAWAL_ROUTING,
        PERMISSIONS.CAN_VIEW_VAS_SETTINGS,
        PERMISSIONS.CAN_VIEW_TRANSFER_PROVIDER_SETTINGS,

        # transactions
        PERMISSIONS.CAN_VIEW_TRANSACTION,
        PERMISSIONS.CAN_INITIATE_TRANSFER,
        PERMISSIONS.CAN_INITIATE_VAS,
        PERMISSIONS.CAN_INITIATE_CASHOUT,
        PERMISSIONS.CAN_INITIATE_PRODUCT,
        PERMISSIONS.CAN_INITIATE_COMMISSION_PAYOUT,
        PERMISSIONS.CAN_FINALISE_TRANSACTION,
        PERMISSIONS.CAN_GET_TRANSACTION_STATS,
        PERMISSIONS.CAN_SEND_STATEMENT,
        PERMISSIONS.CAN_DOWNLOAD_STATEMENT,
        PERMISSIONS.CAN_VIEW_SUCCESS_RATES,
        PERMISSIONS.CAN_PAY_FOR_TERMINAL,

        # wallet
        PERMISSIONS.CAN_CREATE_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET,
        PERMISSIONS.CAN_VIEW_WALLET_LIST,
        PERMISSIONS.CAN_UPDATE_WALLET,
        PERMISSIONS.CAN_CREATE_TRANSACTION_PIN,
        PERMISSIONS.CAN_UPDATE_WALLET_KYC_LEVEL,
        PERMISSIONS.CAN_RETRIEVE_TERMINAL,
        PERMISSIONS.CAN_REPLACE_TERMINAL,
        PERMISSIONS.CAN_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_BULK_UPDATE_WALLET_TERMINAL_PROFILE,
        PERMISSIONS.CAN_GET_WALLET_STATS,
        PERMISSIONS.CAN_GET_COMMISSION_STATS,

        # terminal
        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,

    ],
    "Accounts": [
        PERMISSIONS.CAN_VIEW_DASHBOARD,
        PERMISSIONS.CAN_BLOCK_AGENT,
        PERMISSIONS.CAN_VIEW_USER,

        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_VIEW_TEAMS_LIST,
        PERMISSIONS.CAN_VIEW_TEAM_STATS,

        PERMISSIONS.CAN_VIEW_TRANSACTION,

        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,

    ],
    "Reconciliation": [
        PERMISSIONS.CAN_VIEW_DASHBOARD,
        PERMISSIONS.CAN_BLOCK_AGENT,
        PERMISSIONS.CAN_VIEW_USER,

        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_VIEW_TEAMS_LIST,
        PERMISSIONS.CAN_VIEW_TEAM_STATS,

        PERMISSIONS.CAN_VIEW_TRANSACTION,

        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,

    ],
    "MaComm": [
        PERMISSIONS.CAN_VIEW_DASHBOARD,
        PERMISSIONS.CAN_BLOCK_AGENT,
        PERMISSIONS.CAN_VIEW_USER,

        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_VIEW_TEAMS_LIST,
        PERMISSIONS.CAN_VIEW_TEAM_STATS,

        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,

    ],
    "Customer Support Supervisor": [
        PERMISSIONS.CAN_VIEW_DASHBOARD,
        PERMISSIONS.CAN_BLOCK_AGENT,

        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_VIEW_TEAM,
        PERMISSIONS.CAN_CREATE_AGENT,
        PERMISSIONS.CAN_VIEW_TEAMS_LIST,
        PERMISSIONS.CAN_VIEW_TEAM_STATS,

        PERMISSIONS.CAN_CREATE_TERMINAL_PROFILE,
        PERMISSIONS.CAN_EDIT_TERMINAL_PROFILE,
        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE,
        PERMISSIONS.CAN_VIEW_TERMINAL_PROFILE_LIST,

        PERMISSIONS.CAN_CREATE_VAS_FEE,
        PERMISSIONS.CAN_VIEW_VAS_FEE,

        PERMISSIONS.CAN_MANAGE_WEMA_COLLECTION,

        PERMISSIONS.CAN_VIEW_WITHDRAWAL_ROUTING,
        PERMISSIONS.CAN_VIEW_VAS_SETTINGS,
        PERMISSIONS.CAN_VIEW_TRANSFER_PROVIDER_SETTINGS,

        PERMISSIONS.CAN_GET_TRANSACTION_STATS,
        PERMISSIONS.CAN_VIEW_TRANSACTION,

        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,

    ],
    "Customer Support Officer": [
        PERMISSIONS.CAN_VIEW_DASHBOARD,
        PERMISSIONS.CAN_BLOCK_AGENT,
        PERMISSIONS.CAN_VIEW_TEAM,
        PERMISSIONS.CAN_CREATE_AGENT,
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_VIEW_TEAMS_LIST,
        PERMISSIONS.CAN_VIEW_TEAM_STATS,

        PERMISSIONS.CAN_GET_TRANSACTION_STATS,
        PERMISSIONS.CAN_VIEW_TRANSACTION,

        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,

    ],
    "Head Internal Control": [
        PERMISSIONS.CAN_VIEW_DASHBOARD,
        PERMISSIONS.CAN_VIEW_TEAMS_LIST,
        PERMISSIONS.CAN_VIEW_TEAM,
        PERMISSIONS.CAN_INVITE_TEAM_USER,
        PERMISSIONS.CAN_VIEW_TEAM_STATS,
        PERMISSIONS.CAN_RETRIEVE_DIRECT_REPORT,
        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_VIEW_USER,

        PERMISSIONS.CAN_GET_TRANSACTION_STATS,
        PERMISSIONS.CAN_VIEW_TRANSACTION,

        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,

    ],
    "Internal Control Officer": [
        PERMISSIONS.CAN_VIEW_DASHBOARD,
        PERMISSIONS.CAN_VIEW_AGENT_LIST,
        PERMISSIONS.CAN_VIEW_USER,
        PERMISSIONS.CAN_VIEW_TEAMS_LIST,
        PERMISSIONS.CAN_VIEW_TEAM_STATS,

        PERMISSIONS.CAN_GET_TRANSACTION_STATS,
        PERMISSIONS.CAN_VIEW_TRANSACTION,

        PERMISSIONS.CAN_GET_TERMINAL_STATS,
        PERMISSIONS.CAN_GET_TERMINAL_DETAILS,
        PERMISSIONS.CAN_GET_TERMINAL_WALLET_TERMINAL_LIST,

    ]
}


def role_has_permission(_role, _permission):
    role_permissions = ROLE_PERMISSIONS.get(_role, [])
    return _permission in role_permissions


def permission_required(perm, raise_exception=True):
    def decorator(view_func):
        @wraps(view_func)
        def wrapper(cls, request, *args, **kwargs):
            if isinstance(perm, str):
                perms = (perm,)
            else:
                perms = perm

            user = request.user

            def check_perm(user_obj, perm_list):
                return all(role_has_permission(user_obj.role, _perm) for _perm in perm_list)

            if user and check_perm(user, perms) is False and raise_exception:
                raise PermissionDenied
            return view_func(cls, request, *args, **kwargs)

        return wrapper

    return decorator
