class CodedError(Exception):

    def __init__(
        self,       # type: CodedError
        code,       # type: int
        message,    # type: str
    ):
        # type: (...) -> None

        self.code = code
        self.message = message


class OrderError(object):

    INVALID_CONTEXT = CodedError(
        code=24,
        message="Invalid context",
    )

    MAX_QUANTITY_EXCEEDED = CodedError(
        code=39,
        message="Max quantity exceeded",
    )

    PRODUCT_IN_RUPTURE = CodedError(
        code=40,
        message="Product is ruptured",
    )

    UNAVAILABLE_PRODUCT_STOCK = CodedError(
        code=41,
        message="Product has no available stock",
    )

    ADD_PRODUCT_WITH_MANDATORY_CUSTOMIZATION_ON_TOTAL = CodedError(
        code=42,
        message="Cannot add a product with unresolved mandatory customizations on total",
    )

    PRODUCT_BARCODE_NOT_FOUND = CodedError(
        code=43,
        message="Barcode product does not exists",
    )

    CANNOT_TOTAL_ORDER_WITH_NOT_FILLED_MANDATORY_OPTION = CodedError(
        code=44,
        message="Cannot total order because missing mandatory customization",
    )

    CANNOT_SAVE_ORDER_WITH_NOT_FILLED_MANDATORY_OPTION = CodedError(
        code=45,
        message="Cannot save order because missing mandatory customization",
    )

    CANNOT_TOTAL_EMPTY_ORDER = CodedError(
        code=46,
        message="Cannot total order because order is empty",
    )

    CANNOT_SAVE_EMPTY_ORDER = CodedError(
        code=47,
        message="Cannot save order because order is empty",
    )
