package fake

import (
	"net/http"
	"time"

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

type Record struct {
	ID        int
	User      string
	Character string
	Content   string
	Created   time.Time
	Status    string
}

type Records []Record

// GetRecords return all records
func GetRecords(c *gin.Context) {
	data := Records{
		{1, "yc", "dba", "悄悄的租了个操作", time.Now(), "居然成功了"},
		{2, "yc", "dba", "又做了点小动作", time.Now(), "哎呀失败了"},
		{2, "yc", "dba", "随便做了个SQL审核", time.Now(), "服务器正在做呢"},
	}
	c.JSON(http.StatusOK,
		gin.H{
			"code": 20000,
			"msg":  "Get records",
			"data": data,
		},
	)
}

// GetRecordByID return record by id
func GetRecordByID(c *gin.Context) {
	data := Record{1, "yc", "dba", "悄悄的租了个操作", time.Now(), "居然成功了"}
	c.JSON(http.StatusOK,
		gin.H{
			"code": 20000,
			"msg":  "Get record by item name",
			"data": data,
		},
	)
}
