package controller

import (
	"github.com/gin-gonic/gin"
	edgeService "iot_manager_service/app/security/edge_service"
	"iot_manager_service/util/common"
	"net/http"
)

// TODO: 未记录日志
var Rewind = new(rewindCtl)

type rewindCtl struct{}

func (c rewindCtl) RewindText(ctx *gin.Context) {
	streamId := ctx.Query("streamId")
	date := ctx.Query("date")
	edgeService := edgeService.ForRewindService{}
	operate, err := edgeService.GetRewindText(streamId, date)
	if err != nil {
		ctx.JSON(http.StatusOK, err)
	}
	if operate == "" {
		ctx.JSON(http.StatusOK, nil)
		return
	}
	ctx.JSON(http.StatusOK, common.SuccessResponse(common.Success, operate))
}
