from fastapi import HTTPException, status


class InsufficientCreditsError(HTTPException):
    def __init__(self):
        super().__init__(
            status_code=status.HTTP_402_PAYMENT_REQUIRED,
            detail="积分不足，请充值",
        )


class CaptchaFailedError(HTTPException):
    def __init__(self):
        super().__init__(
            status_code=status.HTTP_400_BAD_REQUEST,
            detail="验证码校验失败",
        )


class RecordNotFoundError(HTTPException):
    def __init__(self):
        super().__init__(
            status_code=status.HTTP_404_NOT_FOUND,
            detail="记录不存在",
        )


class ProjectNotFoundError(HTTPException):
    def __init__(self):
        super().__init__(
            status_code=status.HTTP_404_NOT_FOUND,
            detail="项目不存在",
        )


class InvalidStatusError(HTTPException):
    def __init__(self, detail: str = "当前状态不允许此操作"):
        super().__init__(
            status_code=status.HTTP_400_BAD_REQUEST,
            detail=detail,
        )
