# Path: graphene_django_extras/directives/base.py
# class BaseExtraGraphQLDirective(GraphQLDirective):
#     def __init__(self):
#         registry = get_global_registry()
#         super(BaseExtraGraphQLDirective, self).__init__(
#             name=self.get_name(),
#             description=self.__doc__,
#             args=self.get_args(),
#             locations=[
#                 DirectiveLocation.FIELD,
#                 DirectiveLocation.FRAGMENT_SPREAD,
#                 DirectiveLocation.INLINE_FRAGMENT,
#             ],
#         )
#         registry.register_directive(self.get_name(), self)
# 
#     @classmethod
#     def get_name(cls):
#         return to_snake_case(cls.__name__.replace("GraphQLDirective", ""))
# 
#     @staticmethod
#     def get_args():
#         return {}


import math
from graphql import GraphQLString
from .base import BaseExtraGraphQLDirective
# -*- coding: utf-8 -*-



__all__ = ("FloorGraphQLDirective", "CeilGraphQLDirective")


class FloorGraphQLDirective(BaseExtraGraphQLDirective):
    """
    Floors value. Supports both String and Float fields.
    """

    @staticmethod
    def resolve(value, directive, root, info, **kwargs):
        new_value = math.floor(float(value))
        return str(new_value) if info.return_type == GraphQLString else new_value



# Path: graphene_django_extras/directives/base.py
# class BaseExtraGraphQLDirective(GraphQLDirective):
#     def __init__(self):
#         registry = get_global_registry()
#         super(BaseExtraGraphQLDirective, self).__init__(
#             name=self.get_name(),
#             description=self.__doc__,
#             args=self.get_args(),
#             locations=[
#                 DirectiveLocation.FIELD,
#                 DirectiveLocation.FRAGMENT_SPREAD,
#                 DirectiveLocation.INLINE_FRAGMENT,
#             ],
#         )
#         registry.register_directive(self.get_name(), self)
# 
#     @classmethod
#     def get_name(cls):
#         return to_snake_case(cls.__name__.replace("GraphQLDirective", ""))
# 
#     @staticmethod
#     def get_args():
#         return {}


# Path: graphene_django_extras/directives/numbers.py
import math
from graphql import GraphQLString
from .base import BaseExtraGraphQLDirective

# -*- coding: utf-8 -*-



__all__ = ("FloorGraphQLDirective", "CeilGraphQLDirective")


class FloorGraphQLDirective(BaseExtraGraphQLDirective):
    """
    Floors value. Supports both String and Float fields.
    """

    @staticmethod
    def resolve(value, directive, root, info, **kwargs):
        new_value = math.floor(float(value))
        return str(new_value) if info.return_type == GraphQLString else new_value



class CeilGraphQLDirective(BaseExtraGraphQLDirective):