# -*- coding: utf-8 -*-
from __future__ import annotations

import logging
import uuid

from hotpocket_backend.apps.accounts.models import Account

LOGGER = logging.getLogger(__name__)


class AccountsService:
    class AccountsServiceError(Exception):
        pass

    class AccountNotFound(AccountsServiceError):
        pass

    def get(self, *, pk: uuid.UUID) -> Account:
        try:
            query_set = Account.objects.filter(is_active=True)

            return query_set.get(pk=pk)
        except Account.DoesNotExist as exception:
            raise self.AccountNotFound(
                f'Account not found: pk=`{pk}`',
            ) from exception
