# Path: shelf/error_code.py
# class ErrorCode(object):
#     RESOURCE_NOT_FOUND = "resource_not_found"
#     INTERNAL_SERVER_ERROR = "internal_server_error"
#     DUPLICATE_ARTIFACT = "duplicate_artifact"
#     INVALID_ARTIFACT_NAME = "invalid_artifact_name"
#     FORBIDDEN = "forbidden"
#     INVALID_SEARCH_CRITERIA = "invalid_search_criteria"
#     BAD_REQUEST = "bad_request"
#     PERMISSION_DENIED = "permission_denied"
#     INVALID_REQUEST_DATA_FORMAT = "invalid_request_data_format"


from shelf.error_code import ErrorCode


class CloudStorageException(Exception):
    def __init__(self, message, error_code):
        super(CloudStorageException, self).__init__(message)
        self.error_code = error_code


class ArtifactNotFoundError(CloudStorageException):
    def __init__(self, artifact_name):
        message = "Artifact {0} not found".format(artifact_name)
        super(ArtifactNotFoundError, self).__init__(message, ErrorCode.RESOURCE_NOT_FOUND)


class BucketNotFoundError(CloudStorageException):
    def __init__(self, bucket_name):
        message = "Bucket {0} not found".format(bucket_name)
        super(BucketNotFoundError, self).__init__(message, ErrorCode.RESOURCE_NOT_FOUND)


class DuplicateArtifactError(CloudStorageException):
    def __init__(self, artifact_name):
        message = "Artifact by name {0} already exists in current directory".format(artifact_name)

# Path: shelf/error_code.py
# class ErrorCode(object):
#     RESOURCE_NOT_FOUND = "resource_not_found"
#     INTERNAL_SERVER_ERROR = "internal_server_error"
#     DUPLICATE_ARTIFACT = "duplicate_artifact"
#     INVALID_ARTIFACT_NAME = "invalid_artifact_name"
#     FORBIDDEN = "forbidden"
#     INVALID_SEARCH_CRITERIA = "invalid_search_criteria"
#     BAD_REQUEST = "bad_request"
#     PERMISSION_DENIED = "permission_denied"
#     INVALID_REQUEST_DATA_FORMAT = "invalid_request_data_format"


# Path: shelf/cloud/cloud_exceptions.py
from shelf.error_code import ErrorCode



class CloudStorageException(Exception):
    def __init__(self, message, error_code):
        super(CloudStorageException, self).__init__(message)
        self.error_code = error_code


class ArtifactNotFoundError(CloudStorageException):
    def __init__(self, artifact_name):
        message = "Artifact {0} not found".format(artifact_name)
        super(ArtifactNotFoundError, self).__init__(message, ErrorCode.RESOURCE_NOT_FOUND)


class BucketNotFoundError(CloudStorageException):
    def __init__(self, bucket_name):
        message = "Bucket {0} not found".format(bucket_name)
        super(BucketNotFoundError, self).__init__(message, ErrorCode.RESOURCE_NOT_FOUND)


class DuplicateArtifactError(CloudStorageException):
    def __init__(self, artifact_name):
        message = "Artifact by name {0} already exists in current directory".format(artifact_name)

        super(DuplicateArtifactError, self).__init__(message, ErrorCode.DUPLICATE_ARTIFACT)