package main

import (
	"tzld_rec/src/controller"
	"tzld_rec/src/sort"
	//"tzld_rec/src/filter"

	"gitlab.alibaba-inc.com/pai_biz_arch/pairec"
	psort "gitlab.alibaba-inc.com/pai_biz_arch/pairec/sort"
	//pfilter "gitlab.alibaba-inc.com/pai_biz_arch/pairec/filter"
	"gitlab.alibaba-inc.com/pai_biz_arch/pairec/web/proxy"
)

func main() {
	pairec.AddStartHook(func() error {
		psort.RegisterSort("VideoMixSort", sort.NewVideoMixSort())
		psort.RegisterSort("UniqueUploaderSort", sort.UniqueUploaderSort())
		//pfilter.RegisterFilter("DrationFilter", filter.NewDurationFilter())
		return nil
	})

	videoController := &controller.VideoFeedController{}
	proxyController := proxy.ProxyController{
		RequestInfo: &proxy.RequestInfo{
			Method:            "Post",
			Path:              "/api/rec/internal/video_feed",
			Timeout:           500,
			ResponseFunc:      videoController.ProxyResponseFunc,
			ErrorResponseFunc: videoController.ProxyErrorResponseFunc,
		},
	}

	pairec.Route("/api/rec/internal/video_feed", videoController)
	pairec.Route("/api/rec/video_feed", &proxyController)
	pairec.Run()
}
