package service

import (
	"github.com/UpmeshLTD/urus-aio/infrastructure/utils"
	"github.com/gin-gonic/gin"
	"net/http"
)

type iHealthCheck interface {
	NewGetInfo() gin.HandlerFunc
	NewHealthCheck() gin.HandlerFunc
}

// NewGetInfo godoc
// @Summary Show the info of server.
// @Description Get the info of server.
// @Tags HeathCheck
// @Accept */*
// @Produce json
// @Success 200 {object} string
// @Router / [get]
func (i *serviceImpl) NewGetInfo() gin.HandlerFunc {
	return func(ctx *gin.Context) {
		ctx.JSON(http.StatusOK, utils.GetInfo(i.cfg.IsDevelopment()))
	}
}

// NewHealthCheck godoc
// @Summary Show the status of server.
// @Description Get the status of server.
// @Tags HeathCheck
// @Accept */*
// @Produce json
// @Success 200 {object} string
// @Router /health-check [get]
func (i *serviceImpl) NewHealthCheck() gin.HandlerFunc {
	return func(ctx *gin.Context) {
		ctx.JSON(http.StatusOK, "Health")
	}
}
