from __future__ import annotations

from rapidy.version import AIOHTTP_VERSION_TUPLE

if AIOHTTP_VERSION_TUPLE >= (3, 9, 0):
    from rapidy.web_exceptions import HTTPMove, NotAppKeyWarning

from aiohttp.web import run_app
from aiohttp.web_fileresponse import FileResponse
from aiohttp.web_server import Server
from aiohttp.web_ws import WebSocketReady, WebSocketResponse, WSMsgType

from rapidy.parameters.http import (
    Body,
    Cookie,
    Cookies,
    Header,
    Headers,
    PathParam,
    PathParams,
    QueryParam,
    QueryParams,
)
from rapidy.web_app import Application, CleanupError
from rapidy.web_exceptions import (
    HTTPAccepted,
    HTTPBadGateway,
    HTTPBadRequest,
    HTTPClientError,
    HTTPConflict,
    HTTPCreated,
    HTTPError,
    HTTPException,
    HTTPExpectationFailed,
    HTTPFailedDependency,
    HTTPForbidden,
    HTTPFound,
    HTTPGatewayTimeout,
    HTTPGone,
    HTTPInsufficientStorage,
    HTTPInternalServerError,
    HTTPLengthRequired,
    HTTPMethodNotAllowed,
    HTTPMisdirectedRequest,
    HTTPMovedPermanently,
    HTTPMultipleChoices,
    HTTPNetworkAuthenticationRequired,
    HTTPNoContent,
    HTTPNonAuthoritativeInformation,
    HTTPNotAcceptable,
    HTTPNotExtended,
    HTTPNotFound,
    HTTPNotImplemented,
    HTTPNotModified,
    HTTPOk,
    HTTPPartialContent,
    HTTPPaymentRequired,
    HTTPPermanentRedirect,
    HTTPPreconditionFailed,
    HTTPPreconditionRequired,
    HTTPProxyAuthenticationRequired,
    HTTPRedirection,
    HTTPRequestEntityTooLarge,
    HTTPRequestHeaderFieldsTooLarge,
    HTTPRequestRangeNotSatisfiable,
    HTTPRequestTimeout,
    HTTPRequestURITooLong,
    HTTPResetContent,
    HTTPSeeOther,
    HTTPServerError,
    HTTPServiceUnavailable,
    HTTPSuccessful,
    HTTPTemporaryRedirect,
    HTTPTooManyRequests,
    HTTPUnauthorized,
    HTTPUnavailableForLegalReasons,
    HTTPUnprocessableEntity,
    HTTPUnsupportedMediaType,
    HTTPUpgradeRequired,
    HTTPUseProxy,
    HTTPValidationFailure,
    HTTPVariantAlsoNegotiates,
    HTTPVersionNotSupported,
)
from rapidy.web_middlewares import middleware, normalize_path_middleware
from rapidy.web_request import BaseRequest, FileField, Request
from rapidy.web_response import Response, StreamResponse
from rapidy.web_routedef import (
    AbstractRouteDef,
    delete,
    get,
    head,
    options,
    patch,
    post,
    put,
    route,
    RouteDef,
    RouteTableDef,
    static,
    StaticDef,
    view,
)
from rapidy.web_urldispatcher import (
    AbstractResource,
    AbstractRoute,
    DynamicResource,
    PlainResource,
    PrefixedSubAppResource,
    Resource,
    ResourceRoute,
    StaticResource,
    UrlDispatcher,
    UrlMappingMatchInfo,
    View,
)

__all__ = [
    # web_app
    'Application',
    'CleanupError',
    # web_exceptions
    'HTTPAccepted',
    'HTTPBadGateway',
    'HTTPBadRequest',
    'HTTPClientError',
    'HTTPConflict',
    'HTTPCreated',
    'HTTPError',
    'HTTPException',
    'HTTPExpectationFailed',
    'HTTPFailedDependency',
    'HTTPForbidden',
    'HTTPFound',
    'HTTPGatewayTimeout',
    'HTTPGone',
    'HTTPInsufficientStorage',
    'HTTPInternalServerError',
    'HTTPLengthRequired',
    'HTTPMethodNotAllowed',
    'HTTPMisdirectedRequest',
    'HTTPMovedPermanently',
    'HTTPMultipleChoices',
    'HTTPNetworkAuthenticationRequired',
    'HTTPNoContent',
    'HTTPNonAuthoritativeInformation',
    'HTTPNotAcceptable',
    'HTTPNotExtended',
    'HTTPNotFound',
    'HTTPNotImplemented',
    'HTTPNotModified',
    'HTTPOk',
    'HTTPPartialContent',
    'HTTPPaymentRequired',
    'HTTPPermanentRedirect',
    'HTTPPreconditionFailed',
    'HTTPPreconditionRequired',
    'HTTPProxyAuthenticationRequired',
    'HTTPRedirection',
    'HTTPRequestEntityTooLarge',
    'HTTPRequestHeaderFieldsTooLarge',
    'HTTPRequestRangeNotSatisfiable',
    'HTTPRequestTimeout',
    'HTTPRequestURITooLong',
    'HTTPResetContent',
    'HTTPSeeOther',
    'HTTPServerError',
    'HTTPServiceUnavailable',
    'HTTPSuccessful',
    'HTTPTemporaryRedirect',
    'HTTPTooManyRequests',
    'HTTPUnauthorized',
    'HTTPUnavailableForLegalReasons',
    'HTTPUnprocessableEntity',
    'HTTPValidationFailure',
    'HTTPUnsupportedMediaType',
    'HTTPUpgradeRequired',
    'HTTPUseProxy',
    'HTTPVariantAlsoNegotiates',
    'HTTPVersionNotSupported',
    # web_fileresponse
    'FileResponse',
    # web_middlewares
    'middleware',
    'normalize_path_middleware',
    # web_request
    'BaseRequest',
    'FileField',
    'Request',
    # web_response
    'Response',
    'StreamResponse',
    # web_routedef
    'AbstractRouteDef',
    'RouteDef',
    'RouteTableDef',
    'StaticDef',
    'delete',
    'get',
    'head',
    'options',
    'patch',
    'post',
    'put',
    'route',
    'static',
    'view',
    # web_server
    'Server',
    # web_urldispatcher
    'AbstractResource',
    'AbstractRoute',
    'DynamicResource',
    'PlainResource',
    'PrefixedSubAppResource',
    'Resource',
    'ResourceRoute',
    'StaticResource',
    'UrlDispatcher',
    'UrlMappingMatchInfo',
    'View',
    # web
    # web_ws
    'WebSocketReady',
    'WebSocketResponse',
    'WSMsgType',
    'run_app',
    # request_params
    'Body',
    'Cookie',
    'Cookies',
    'Header',
    'Headers',
    'PathParam',
    'PathParams',
    'QueryParam',
    'QueryParams',
]
if AIOHTTP_VERSION_TUPLE >= (3, 9, 0):
    __all__ += [
        # web_exceptions
        'HTTPMove',
        'NotAppKeyWarning',
    ]
