package bundle

import (
	"context"
	"fonchain-fiee/api/bundle"
	"fonchain-fiee/pkg/service"

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

func BundleExtend(c *gin.Context) {
	var req bundle.BundleExtendRequest
	if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
		service.Error(c, err)
		return
	}
	res, err := service.BundleProvider.BundleExtend(context.Background(), &req)
	if err != nil {
		service.Error(c, err)
		return
	}
	service.Success(c, res)
}

func BundleExtendRecordsList(c *gin.Context) {
	var req bundle.BundleExtendRecordsListRequest
	if err := c.ShouldBindBodyWith(&req, binding.JSON); err != nil {
		service.Error(c, err)
		return
	}
	res, err := service.BundleProvider.BundleExtendRecordsList(context.Background(), &req)
	if err != nil {
		service.Error(c, err)
		return
	}
	service.Success(c, res)
}
