# Path: async_v20/definitions/helpers.py
# def domain_check(value, example=None, possible_values=None):
#     if example:
#         if not len(str(example)) == len(str(value)):
#             msg = f'{value} does not match length of example {example}'
#             logger.error(msg)
#             raise InvalidValue(msg)
# 
#     if possible_values:
#         if not value in possible_values:
#             possible_values = ', '.join(possible_values)
#             msg = f'{value} must be in {possible_values}. Possible values are {possible_values}'
#             logger.error(msg)
#             raise InvalidValue(msg)
# 
#     return True
# 
# Path: async_v20/exceptions.py
# class InvalidValue(AsyncV20Exception):
#     """A supplied value does not meet the specification
#     of valid values"""
#     pass
# 
# class InvalidFormatArguments(AsyncV20Exception):
#     """Arguments to format a DecimalNumber or PriceValue
#     are invalid"""
#     pass


import logging
import pandas as pd
from .helpers import domain_check
from ..exceptions import InvalidValue, InvalidFormatArguments

    # Correct syntax of value
    format_syntax = 'A string containing an ISO 4217 currency'

    def __new__(cls, value):
        return super().__new__(cls, value)


class DecimalNumber(float, Primitive):
    """The string representation of a decimal number.
    """

    # Correct syntax of value
    format_syntax = 'A decimal number encoded as a string. The amount of precision ' \
                    'provided depends on what the number represents.'

    def __new__(cls, value):
        return super().__new__(cls, value)

    def format(self, precision, min_=None, max_=None):
        # A DecimalNumber can se + / -
        if not precision >= 0:
            msg = f'Cannot format PriceValue. precision {precision} must be >= 0'
            logger.error(msg)
            raise InvalidFormatArguments(msg)

        if min_ and max_:
            if not min_ <= max_:
                msg = f'Cannot format PriceValue. min_ {min_} is not <= max_ {max_}'
                logger.error(msg)

# Path: async_v20/definitions/helpers.py
# def domain_check(value, example=None, possible_values=None):
#     if example:
#         if not len(str(example)) == len(str(value)):
#             msg = f'{value} does not match length of example {example}'
#             logger.error(msg)
#             raise InvalidValue(msg)
# 
#     if possible_values:
#         if not value in possible_values:
#             possible_values = ', '.join(possible_values)
#             msg = f'{value} must be in {possible_values}. Possible values are {possible_values}'
#             logger.error(msg)
#             raise InvalidValue(msg)
# 
#     return True
# 
# Path: async_v20/exceptions.py
# class InvalidValue(AsyncV20Exception):
#     """A supplied value does not meet the specification
#     of valid values"""
#     pass
# 
# class InvalidFormatArguments(AsyncV20Exception):
#     """Arguments to format a DecimalNumber or PriceValue
#     are invalid"""
#     pass


# Path: async_v20/definitions/primitives.py
import logging
import pandas as pd
from .helpers import domain_check
from ..exceptions import InvalidValue, InvalidFormatArguments


    # Correct syntax of value
    format_syntax = 'A string containing an ISO 4217 currency'

    def __new__(cls, value):
        return super().__new__(cls, value)


class DecimalNumber(float, Primitive):
    """The string representation of a decimal number.
    """

    # Correct syntax of value
    format_syntax = 'A decimal number encoded as a string. The amount of precision ' \
                    'provided depends on what the number represents.'

    def __new__(cls, value):
        return super().__new__(cls, value)

    def format(self, precision, min_=None, max_=None):
        # A DecimalNumber can se + / -
        if not precision >= 0:
            msg = f'Cannot format PriceValue. precision {precision} must be >= 0'
            logger.error(msg)
            raise InvalidFormatArguments(msg)

        if min_ and max_:
            if not min_ <= max_:
                msg = f'Cannot format PriceValue. min_ {min_} is not <= max_ {max_}'
                logger.error(msg)

                raise InvalidFormatArguments(msg)