package fake

import (
	"net/http"

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

type Instance struct {
	ID     int
	Name   string
	Status string
}

type Instances []Instance

// GetInstances return all instances
func GetInstances(c *gin.Context) {
	data := Instances{
		{1, "假装这里有一个实例", "RUN"},
		{2, "假装这里也有一个实例", "STOP"},
		{3, "假装这里还有一个实例", "FAIL"},
	}
	c.JSON(http.StatusOK,
		gin.H{
			"code": 20000,
			"msg":  "Get instances",
			"data": data,
		},
	)
}

// GetInstanceByID return instance by id
func GetInstanceByID(c *gin.Context) {
	data := Instance{1, "假装这里有一个实例", "RUN"}
	c.JSON(http.StatusOK,
		gin.H{
			"code": 20000,
			"msg":  "Get instance by item name",
			"data": data,
		},
	)
}
