package test

import (
	"fmt"
	"net/http"

	req "../../../core/request"
	res "../../../core/response"

	auth "../../lib/auth"
	errorHandler "../../lib/error"
)

type Profile struct {
	Name    string
	Hobbies []string
}

//Inicial : Func
func Inicial(w http.ResponseWriter, r *http.Request, vars []string) {

	user, err := auth.GetUser(r)

	fmt.Printf("%+v\n", user)
	fmt.Printf("%+v\n", err)

	var Errors errorHandler.Errors
	// fmt.Println(vars[0])
	// fmt.Fprintf(w, "Hello Route, %q", html.EscapeString(r.URL.Path))
	// profile := Profile{"Alex", []string{"snowboarding", "programming"}}

	if err := r.ParseForm(); err != nil {
		fmt.Printf("ParseForm() err: %v", err)
		return
	}

	Errors.InvalidParameter("username", "Usuário não disponível")
	Errors.InternalError("Ocorreu um erro interno")
	Errors.ActionForbidden("Ocorreu um erro interno2")
	if Errors.Has() {
		res.JSON(Errors)
		return
	}

	fmt.Println(req.Method())

	// res.SetCode(404)
	// res.JSON(profile)

}
