package fake

import (
	"net/http"
	"time"

	"github.com/gin-gonic/gin"
)

type User struct {
	ID         int
	Name       string
	Character  string
	LastLogin  time.Time
	LoginCount int
	Status     string
}

type Users []User

// GetUsers return all users
func GetUsers(c *gin.Context) {
	data := Users{
		{1, "wyd", "admin", time.Now(), 0, "online"},
		{2, "yc", "dba", time.Now(), 0, "offline"},
		{3, "zhy", "admin", time.Now(), 0, "online"},
		{4, "unknown", "user", time.Now(), 0, "online"},
	}
	c.JSON(http.StatusOK,
		gin.H{
			"code": 20000,
			"msg":  "Get users",
			"data": data,
		},
	)
}

// GetUserByID return user by id
func GetUserByID(c *gin.Context) {
	data := User{1, "wyd", "admin", time.Now(), 0, "online"}
	c.JSON(http.StatusOK,
		gin.H{
			"code": 20000,
			"msg":  "Get user by id",
			"data": data,
		},
	)
}
