 //
 
 import Foundation
+import Alamofire
 
 class WaitlistsApiController: AuthenticatedController, WaitlistsController {
     

                                forSession session: Session,
                                success: ((Session.Waitlist) -> Void)?,
                                failure: Controller.MethodFailure?) {
//        var body = Request.Body()
//        body.add(auth?.currentUser?.customer.id, for: "customer")
//        body.add(action, for: "action")
//        
//        let request = requestBuilder.build(for: .sessionWaitlist(sessionId: session.id),
//                                           method: .post,
//                                           contentType: .formUrlEncoded,
//                                           body: body,
//                                           authentication: .userToken)
//        requestExecutor.execute(request: request,
//                                success:
//            { (request, response, data) in
//                guard let data = data else {
//                    failure?(RequestError.unknown)
//                    return
//                }
//                do {
//                    let waitlist = try self.decoder.decode(Session.Waitlist.self, from: data)
//                    success?(waitlist)
//                } catch {
//                    failure?(RequestError(with: error))
//                }
//        }) { (request, response, error) in
//            failure?(error)
//        }
    }
}

              success: ((Session.Waitlist) -> Void)?,
              failure: Controller.MethodFailure?) {
        
        var parameters: Alamofire.Parameters = [:]
        if let customerId = auth?.currentUser?.customer.id {
            parameters["customer"] = customerId
        }
        
        let request = requestBuilder.build(for: .sessionWaitlist(sessionId: session.id),
                                           method: .get,
                                           parameters: parameters,
                                           authentication: .userToken)
        
        requestExecutor.execute(request: request,
                                success:
            { (request, response, data) in
                guard let data = data else {
                    failure?(TeamupError.unknown, nil)
                    return
                }
                do {
                    let waitlist = try self.decoder.decode(Session.Waitlist.self, from: data)
                    success?(waitlist)
                } catch {
                    failure?(error, nil)
                }
        }) { (request, response, error) in
            failure?(error, response?.errorDetail)
        }
    }
    
    func join(forSession session: Session,
