// package main

// import "fmt"

// func main() {
// 	fmt.Println("Hello!")
// }

package main

import (
	"log"
	"net/http"

	dashapi "github.com/moustachioed/dash/backend/dashapi"
	database "github.com/moustachioed/dash/backend/database"
	mapping "github.com/moustachioed/dash/backend/mapping"
	service "github.com/moustachioed/dash/backend/service"
)

func main() {
	db, err := database.NewPgDatabase("localhost", "dash", "dash", "dash", 15432)
	if err != nil {
		log.Fatal(err)
	}

	mapper := mapping.NewMapperImpl()

	// DefaultApiService := dashapi.NewDefaultApiService()
	DefaultApiService := service.NewDefaultApiService(db, mapper)
	DefaultApiController := dashapi.NewDefaultApiController(DefaultApiService)

	router := dashapi.NewRouter(DefaultApiController)

	log.Printf("Starting server.")
	log.Fatal(http.ListenAndServe(":8080", router))
}
