});
$app->get("/thankyou/", function () use($app) {
    $app->render("template.php", array("view" => "thankyou.html"));
});
$app->get("/thankyou2/", function () use($app) {
    $app->render("template.php", array("view" => "thankyou2.html"));
});
$app->get("/events/pokerrun/", function () use($app) {
    $app->render("template.php", array("view" => "pokerrun.html"));
});
$app->post("/pokerrun/", function () use($app) {
    $data = $_POST["data"];
    $response = new JsonResponse();
    $response->successful("Successfully created a new request for poker run.", $data);
});
$app->post("/contact/", function () use($app) {
    $response = new JsonResponse();
    $contact = new Contact();
    $result = $contact->sendContactEmail($_POST['name'], $_POST['email'], $_POST['phone'], $_POST['message']);
    if (result) {
        $response->successful("Message successfully sent. Thank you for contacting Waterfowlers for Warriors.", $result);
    } else {
        $response->unsuccessful("Failed to send message. Please try again later.", $result);
    }
});
$app->post('/profile/', function () use($app) {
    $profile = new Profile();
    $profile->saveProfile($_POST);
    $app->render("template.php", array("view" => "thankyou2.html"));
});
$app->run();