# By: Riasat Ullah

# This file contains all the exceptions that can arise from a user.


class InactiveUser(Exception):

    def __init__(self, message=''):
        '''
        This exception should be thrown when a user is found to be inactive
        while changes are being tried to be made to their account.
        :param message: the error message
        '''
        self.message = message


class InvalidPassword(Exception):

    def __init__(self, message=''):
        '''
        This exception should be thrown when an invalid password is provided.
        :param message: the error message
        '''
        self.message = message


class InvalidUsername(Exception):

    def __init__(self, message=''):
        '''
        This exception should be thrown when an invalid username is provided.
        :param message: the error message
        '''
        self.message = message


class LockedAccount(Exception):

    def __init__(self, message):
        '''
        This exception should be thrown when a user's account is locked.
        :param message: the error message
        '''
        self.message = message


class NotUniqueValue(Exception):

    def __init__(self, message=''):
        '''
        This exception should be thrown when a particular value is not unique.
        :param message: the error message
        '''
        self.message = message


class InvalidRequest(Exception):

    def __init__(self, message):
        '''
        This exception should be thrown when an invalid http request is detected.
        :param message: the error message
        '''
        self.message = message


class UnauthorizedRequest(Exception):

    def __init__(self, message):
        '''
        This exception should be thrown when an unauthorized request is detected.
        :param message: the error message
        '''
        self.message = message


class DependencyFound(Exception):

    def __init__(self, message, additional_message=''):
        '''
        This exception should be thrown when a dependency is found for one item/component to another.
        :param message: the error message
        '''
        self.message = message
        self.additional_message = additional_message


class NoOneIsOnCall(Exception):
    '''
    This exception is raised when no one is on call on a policy at a point in time when an incident is
    trying to be created on it.
    '''
    def __init__(self, message):
        self.message = message


class MaliciousSource(Exception):

    def __init__(self, message):
        '''
        This exception should be thrown when a malicious incoming source is detected.
        :param message: the error message
        '''
        self.message = message


class InsufficientFunds(Exception):

    def __init__(self, message):
        '''
        This exception should be thrown when a there are insufficient funds on a payment source.
        :param message: the error message
        '''
        self.message = message


class CardExpired(Exception):

    def __init__(self, message):
        '''
        This exception should be thrown when a card has expired.
        :param message: the error message
        '''
        self.message = message


class PaymentSourceError(Exception):
    def __init__(self, message):
        '''
        This exception should be thrown when a payment source fails to be processed.
        :param message: the error message
        '''
        self.message = message


class InvalidAddress(Exception):
    def __init__(self, message):
        '''
        This exception should be thrown when a provided address is invalid.
        :param message: the error message
        '''
        self.message = message


class InvalidCoupon(Exception):
    def __init__(self, message=None):
        '''
        This exception should be thrown when an invalid coupon is encountered.
        :param message: the error message
        '''
        self.message = message if message is not None else ''


class VendorError(Exception):
    def __init__(self, message):
        '''
        This exception should be thrown when an error is raised by the vendor.
        :param message: the error message
        '''
        self.message = message


class ServiceUnavailable(Exception):
    def __init__(self, message=None):
        '''
        This exception should be thrown when a service is disabled or in maintenance.
        :param message: the error message
        '''
        if message is not None:
            self.message = message
