from __future__ import annotations

from dataclasses import dataclass
from http import HTTPStatus


@dataclass(frozen=True)
class LicensingError(Exception):
    code: str
    message: str
    http_status: int


INVALID_LICENCE = LicensingError(
    code="invalidLicence",
    message="The licence could not be activated.",
    http_status=HTTPStatus.UNPROCESSABLE_ENTITY,
)
INTEGRATION_RESOURCE_NOT_FOUND = LicensingError(
    code="notFound",
    message="The requested resource was not found.",
    http_status=HTTPStatus.NOT_FOUND,
)
ACTIVATION_LIMIT_EXCEEDED = LicensingError(
    code="activationLimitExceeded",
    message="The activation limit has been reached.",
    http_status=HTTPStatus.CONFLICT,
)
SUSPENDED = LicensingError(
    code="suspended",
    message="This licence is suspended.",
    http_status=HTTPStatus.GONE,
)
REVOKED = LicensingError(
    code="revoked",
    message="This licence is revoked.",
    http_status=HTTPStatus.FORBIDDEN,
)
EXPIRED_SUBSCRIPTION = LicensingError(
    code="expiredSubscription",
    message="This subscription has expired.",
    http_status=HTTPStatus.PAYMENT_REQUIRED,
)
INVALID_ACTIVATION = LicensingError(
    code="invalidActivation",
    message="This activation could not be validated.",
    http_status=HTTPStatus.UNAUTHORIZED,
)
REVOKED_ACTIVATION = LicensingError(
    code="revokedActivation",
    message="This activation is no longer valid.",
    http_status=HTTPStatus.UNAUTHORIZED,
)
