/// Can be converted from a response.
///
/// [Learn More →](https://docs.vapor.codes/3.0/http/response/#responseinitializable)
public protocol ResponseDecodable {
    static func decode(from res: Response, for req: Request) throws -> Future<Self>
}

/// Can be converted to a response
///
/// [Learn More →](https://docs.vapor.codes/3.0/http/response/#responserepresentable)
public protocol ResponseEncodable {
    /// Makes a response using the context provided by the HTTPRequest
    func encode(for req: Request) throws -> Future<Response>
}

/// Can be converted from and to a response
public typealias ResponseCodable = ResponseDecodable & ResponseEncodable

// MARK: Response Conformance

extension Response: ResponseEncodable {
    /// See ResponseRepresentable.makeResponse
    public func encode(for req: Request) throws -> Future<Response> {
        return Future(self)
    }
}

extension HTTPResponse: ResponseEncodable {
    /// See ResponseRepresentable.makeResponse
    public func encode(for req: Request) throws -> Future<Response> {
        let new = req.makeResponse()
        new.http = self
        return Future(new)
    }
}

import HTTP
/// Can be converted from a response.
///
/// [Learn More →](https://docs.vapor.codes/3.0/http/response/#responseinitializable)
public protocol ResponseDecodable {
    static func decode(from res: Response, for req: Request) throws -> Future<Self>
}

/// Can be converted to a response
///
/// [Learn More →](https://docs.vapor.codes/3.0/http/response/#responserepresentable)
public protocol ResponseEncodable {
    /// Makes a response using the context provided by the HTTPRequest
    func encode(for req: Request) throws -> Future<Response>
}

/// Can be converted from and to a response
public typealias ResponseCodable = ResponseDecodable & ResponseEncodable

// MARK: Response Conformance

extension Response: ResponseEncodable {
    /// See ResponseRepresentable.makeResponse
    public func encode(for req: Request) throws -> Future<Response> {
        return Future(self)
    }
}

extension HTTPResponse: ResponseEncodable {
    /// See ResponseRepresentable.makeResponse
    public func encode(for req: Request) throws -> Future<Response> {
        let new = req.makeResponse()
        new.http = self
        return Future(new)
    }
}

extension HTTPStatus: ResponseEncodable {
    /// See ResponseRepresentable.makeResponse
    public func encode(for req: Request) throws -> Future<Response> {
        let new = req.makeResponse()
        new.http = HTTPResponse(status: self)
        return Future(new)
    }
}

Make HTTPStatus conform to ResponseEncodable
Make HTTPStatus conform to ResponseEncodable

Done so statuses can be returned on their own.

Example:
```
        versionOneGroup.delete("park") { (req)  in
            return req.withConnection(to: .sqlite) { (db) in
                return db.query(Parking.self).first().flatMap(to: HTTPStatus.self) {
                    guard let park = $0 else {
                        throw Abort(.notFound, reason: "Could not find parking.")
                    }
                    
                    return park.delete(on: db).transform(to: HTTPStatus.ok)
                }
            }
        }
```