package lib

import (
	"net/http"
	"strconv"
)

type UserData struct {
	Id_user   string
	Email     string
	Name      string
	Username  string
	Token     string
	Url_token string
	Avatar    string
	Language  string
	Errors    []apiError
}

func (user UserData) getId() int {
	id, _ := strconv.Atoi(user.Id_user)
	return id
}

func GetUser(r *http.Request) *UserData {

	auth := r.Header.Get("Auth")
	userData := curl(auth)

	// debug only
	//fmt.Printf("%+v\n", userData)

	return userData
}
