package test

import (
	"fmt"
	"net/http"

	"../../../core/errorHandler"
	"../../../core/request"
	"../../../core/response"

	auth "../../lib/auth"
)

type Profile struct {
	Name    string
	Hobbies []string
}

//Inicial : Func
func Inicial(w http.ResponseWriter, r *http.Request) {
	fmt.Println(r.Context().Value("parameters").([]string))

	var Errors errorHandler.Errors

	user, err := auth.GetUser(r)

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

	//var errors errors.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() {
		response.JSON(Errors)
		return
	}

	fmt.Println(request.Method())

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

}
