package file_export

import (
	"be.ems/src/framework/middleware"
	"github.com/gin-gonic/gin"
)

// Register Routes for file_export
func Register(r *gin.RouterGroup) {

	lmTable := r.Group("/table")
	{
		var m *SysJob
		lmTable.GET("/list",
			middleware.PreAuthorize(nil),
			m.GetFileExportTable,
		)
		lmTable.POST("/ftp",
			middleware.PreAuthorize(nil),
			m.SetFTPConfig,
		)
		lmTable.GET("/ftp",
			middleware.PreAuthorize(nil),
			m.GetFTPConfig,
		)
		lmTable.PUT("/ftp",
			middleware.PreAuthorize(nil),
			m.PutFTP,
		)
	}
	lmFile := r.Group("/file")
	{
		var f *FileExport
		lmFile.GET("/list",
			middleware.PreAuthorize(nil),
			f.GetFileList,
		)
		lmFile.GET("/total",
			middleware.PreAuthorize(nil),
			f.Total,
		)
		lmFile.GET("/:fileName",
			middleware.PreAuthorize(nil),
			f.DownloadHandler,
		)
		lmFile.DELETE("/:fileName",
			middleware.PreAuthorize(nil),
			f.Delete,
		)
	}
}
