# Path: transmute_core/function/signature.py
# class NoDefault(object):
#     def __str__(self):
#         return "NoDefault"
# 
#     def __repr__(self):
#         return "NoDefault"
# 
# Path: transmute_core/http_parameters/param_set.py
# class Param(object):
#     """a single parameter object."""
# 
#     argument_name = attr.ib()
#     description = attr.ib(default="")
#     # the actual argument object. this gets populated later.
#     arginfo = attr.ib(default=None)
# 
#     def __or__(self, other):
#         raise InvalidTransmuteDefinition(
#             "unable to join a single parameter with any other object."
#         )
# 
#     def values(self):
#         return (self,)
# 
#     def __setitem__(self, key, value):
#         raise InvalidTransmuteDefinition(
#             "unable to add parameter {0} to a single parameter.".format(key)
#         )
# 
# class ParamSet(dict):
#     """
#     a param set represents a set of a particular grouping of
#     parameters, such as header / query / body / etc.
#     """
# 
#     def __or__(self, other):
#         if not isinstance(other, ParamSet):
#             raise TypeError("cannot join ParamSet with a {0}".format(type(other)))
#         for name, definition in other.items():
#             self[name] = definition


from swagger_schema import BodyParameter, QueryParameter, HeaderParameter, PathParameter
from ..function.signature import NoDefault
from .param_set import Param, ParamSet


def get_swagger_parameters(parameters, context):
    ret_parameters = []
    for name, param in parameters.query.items():
        arginfo = param.arginfo
        params = {
            "name": name,
            "description": param.description,
            "required": arginfo.default is NoDefault,
            "collectionFormat": "multi",
        }
        params.update(context.serializers.to_json_schema(arginfo.type))
        ret_parameters.append(QueryParameter(params))

    for name, param in parameters.header.items():
        arginfo = param.arginfo
        params = {
            "name": name,
            "description": param.description,

# Path: transmute_core/function/signature.py
# class NoDefault(object):
#     def __str__(self):
#         return "NoDefault"
# 
#     def __repr__(self):
#         return "NoDefault"
# 
# Path: transmute_core/http_parameters/param_set.py
# class Param(object):
#     """a single parameter object."""
# 
#     argument_name = attr.ib()
#     description = attr.ib(default="")
#     # the actual argument object. this gets populated later.
#     arginfo = attr.ib(default=None)
# 
#     def __or__(self, other):
#         raise InvalidTransmuteDefinition(
#             "unable to join a single parameter with any other object."
#         )
# 
#     def values(self):
#         return (self,)
# 
#     def __setitem__(self, key, value):
#         raise InvalidTransmuteDefinition(
#             "unable to add parameter {0} to a single parameter.".format(key)
#         )
# 
# class ParamSet(dict):
#     """
#     a param set represents a set of a particular grouping of
#     parameters, such as header / query / body / etc.
#     """
# 
#     def __or__(self, other):
#         if not isinstance(other, ParamSet):
#             raise TypeError("cannot join ParamSet with a {0}".format(type(other)))
#         for name, definition in other.items():
#             self[name] = definition


# Path: transmute_core/http_parameters/swagger.py
from swagger_schema import BodyParameter, QueryParameter, HeaderParameter, PathParameter
from ..function.signature import NoDefault
from .param_set import Param, ParamSet



def get_swagger_parameters(parameters, context):
    ret_parameters = []
    for name, param in parameters.query.items():
        arginfo = param.arginfo
        params = {
            "name": name,
            "description": param.description,
            "required": arginfo.default is NoDefault,
            "collectionFormat": "multi",
        }
        params.update(context.serializers.to_json_schema(arginfo.type))
        ret_parameters.append(QueryParameter(params))

    for name, param in parameters.header.items():
        arginfo = param.arginfo
        params = {
            "name": name,
            "description": param.description,

            "required": arginfo.default is NoDefault,