# -*- coding: utf-8 -*-
# Auto-generated by Stone, do not modify.
# @generated
# flake8: noqa
# pylint: skip-file
from __future__ import unicode_literals
from stone.backends.python_rsrc import stone_base as bb
from stone.backends.python_rsrc import stone_validators as bv


class EchoArg(bb.Struct):
    """
    Contains the arguments to be sent to the Dropbox servers.

    :ivar EchoArg.query:
        The string that you'd like to be echoed back to you.
    """

    __slots__ = [
        "_query_value",
    ]

    _has_required_fields = False

    def __init__(self, query=None):
        self._query_value = bb.NOT_SET
        if query is not None:
            self.query = query

    # Instance attribute type: str (validator is set below)
    query = bb.Attribute("query")

    def _process_custom_annotations(self, annotation_type, field_path, processor):
        super(EchoArg, self)._process_custom_annotations(annotation_type, field_path, processor)


EchoArg_validator = bv.Struct(EchoArg)


class EchoError(bb.Union):
    """
    EchoError contains the error returned from the Dropbox servers.

    This class acts as a tagged union. Only one of the ``is_*`` methods will
    return true. To get the associated value of a tag (if one exists), use the
    corresponding ``get_*`` method.

    :ivar EchoError.user_requested:
        The request was successful.
    """

    _catch_all = "other"
    # Attribute is overwritten below the class definition
    user_requested = None
    # Attribute is overwritten below the class definition
    other = None

    def is_user_requested(self):
        """
        Check if the union tag is ``user_requested``.

        :rtype: bool
        """
        return self._tag == "user_requested"

    def is_other(self):
        """
        Check if the union tag is ``other``.

        :rtype: bool
        """
        return self._tag == "other"

    def _process_custom_annotations(self, annotation_type, field_path, processor):
        super(EchoError, self)._process_custom_annotations(annotation_type, field_path, processor)


EchoError_validator = bv.Union(EchoError)


class EchoResult(bb.Struct):
    """
    EchoResult contains the result returned from the Dropbox servers.

    :ivar EchoResult.result:
        If everything worked correctly, this would be the same as query.
    """

    __slots__ = [
        "_result_value",
    ]

    _has_required_fields = False

    def __init__(self, result=None):
        self._result_value = bb.NOT_SET
        if result is not None:
            self.result = result

    # Instance attribute type: str (validator is set below)
    result = bb.Attribute("result")

    def _process_custom_annotations(self, annotation_type, field_path, processor):
        super(EchoResult, self)._process_custom_annotations(annotation_type, field_path, processor)


EchoResult_validator = bv.Struct(EchoResult)

EchoArg.query.validator = bv.String(max_length=500)
EchoArg._all_field_names_ = set(["query"])
EchoArg._all_fields_ = [("query", EchoArg.query.validator)]

EchoError._user_requested_validator = bv.Void()
EchoError._other_validator = bv.Void()
EchoError._tagmap = {
    "user_requested": EchoError._user_requested_validator,
    "other": EchoError._other_validator,
}

EchoError.user_requested = EchoError("user_requested")
EchoError.other = EchoError("other")

EchoResult.result.validator = bv.String()
EchoResult._all_field_names_ = set(["result"])
EchoResult._all_fields_ = [("result", EchoResult.result.validator)]

EchoArg.query.default = ""
EchoResult.result.default = ""
app = bb.Route(
    "app",
    1,
    False,
    EchoArg_validator,
    EchoResult_validator,
    EchoError_validator,
    {"auth": "app", "host": "api", "style": "rpc"},
)
user = bb.Route(
    "user",
    1,
    False,
    EchoArg_validator,
    EchoResult_validator,
    EchoError_validator,
    {"auth": "user", "host": "api", "style": "rpc"},
)

ROUTES = {
    "app": app,
    "user": user,
}
